jenkinsci / lucene-search-plugin

Jenkins plugin for searching job data via Lucene or Solr
https://plugins.jenkins.io/lucene-search
MIT License
5 stars 12 forks source link

search doesn't find builds for jobs in folders #65

Closed arsyee closed 1 year ago

arsyee commented 1 year ago

Jenkins and plugins versions report

Environment ``` Jenkins: 2.401.1 OS: Linux - 5.10.80-flatcar Java: 11.0.19 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- ... lucene-search:398.v3dfa_cb_223984 ... ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Above controller is deployed on Kubernetes by the official (parametrized) Helm charts. Issue was also reproducible running with jenkins/jenkins:2.401.1-jdk11 container from Docker Hub with default plugins + lucene-search:398.v3dfa_cb_223984.

Reproduction steps

  1. Create two jobs, one inside a folder (folder/job), another outside of any folders (other-job), run them, they echo "something"
  2. In search bar, search for: job
  3. In search bar, search for: folder/job
  4. In search bar, search for: other-job
  5. In search bar, search for: something
  6. In search bar, search for: c:something

Expected Results

  1. Whatever is written above does happen.
  2. The following items are found: 2.1: folder/job 2.2: build 1 for folder/job 2.3: other-job 2.4: build 2 for other-job
  3. The following items are found 3.1: folder/job 3.2: build 1 for folder/job
  4. The following items are found: 4.1: other-job 4.2: build 2 for other-job
  5. The following items are found: 5.1: build 1 for folder/job 5.2: build 2 for other-job
  6. The following items are found: 6.1: build 1 for folder/job 6.2: build 2 for other-job

Actual Results

  1. Whatever is written above does happen. OK
  2. The following items are found: 2.1: folder/job MISSING 2.2: build 1 for folder/job MISSING 2.3: other-job OK 2.4: build 2 for other-job OK
  3. The following items are found 3.1: folder/job OK 3.2: build 1 for folder/job MISSING
  4. The following items are found: 4.1: other-job OK 4.2: build 2 for other-job OK
  5. The following items are found: 5.1: build 1 for folder/job MISSING 5.2: build 2 for other-job OK
  6. The following items are found: 6.1: build 1 for folder/job MISSING 6.2: build 2 for other-job OK

Anything else?

Basically jobs in folders and corresponding builds don't really show up in search results, except when searched for in folder/job format. In that case I experience issue #44, but my point is that issue #44 doesn't cover half the problems with folder handling.

tdraebing commented 1 year ago

Thanks for the detailed analysis. I can reproduce the behaviour. Debugging showed that a document with j:folder/job is actually added to the index. The search with folder/jobs fails with a swallowed ParseException due to the /, which has to be escaped since Lucene 4, something I didn't notice when updating Lucene past version 3. I will provide a fix and also look into the other cases.

arsyee commented 1 year ago

Hey, I see there is an open PR/review to fix this bug. May I ask when can we expect it be merged? If I could do anything to make it happen, let me know. (I don't have Jenkins plugin development experience, but I can read code and used Jenkins heavily in the last 5 years. More importantly I do have some free time.)

tdraebing commented 1 year ago

Sorry for the delay. I finished the PR and merged it. The release should happen automatically within the next hours.

arsyee commented 1 year ago

Thanks!