Giter VIP home page Giter VIP logo

lucene-search-plugin's Introduction

Lucene Search Plugin

This plug-in allows you to search for console log and build display name etc.

Lucene is a powerful search library. Many popular search engines like Elastic Search and Solr are built upon it. Lucene Search Plugin uses Lucene library to index and search the console log content. It is embedded in the top search bar of Jenkins.

Database Rebuild

If you have job data before the installation of Lucene Search, you need to rebuild the database manually. Note that any new builds after the installation of Lucene Search will be indexed automatically and the index of deleted builds and jobs will be deleted accordingly.

image

To index the existing data, you need to go to "Manage Jenkins -> Lucene Search Manager" and click rebuild. You can enter the jobs that you want to index. If nothing is entered, all jobs will be indexed by default. There are two modes of rebuild available. In "overwrite" mode, the indexer deletes old index of the job if there are any and then index the job. In "preserve" mode, the indexer searches for the build name. If the build is already indexed, it will skip to the next build. Otherwise, the build will be indexed.

The clean button will delete all your index. Please use it cautiously.

image

Search Query

Lucene Search works in the top search bar of Jenkins. There are two kinds of search queries: single-job search and multi-job search. If you want to perform a search for a specific job, put the job name at the start of your query. If you enter only one word or the first word of your query is not recognized as a job name, the search will be conducted across different jobs.

There are five fields Lucene Search can search: console log, build display name, build parameter, project name, and build number. Here are the rules for the query:

  1. The single-job search query is in the form “jobname queries”; jobname is the name of the job we want to search within; queries is a string of words we want to search for.
  2. If the first word of the query is not recognized as an indexed job name, across-job search will be performed.
  3. Boolean operators(AND is the default operator):
    • AND
    • OR
    • NOT
  4. Wildcards:
    • "*" means zero or more characters
    • "?" means one character
  5. You can limit the range of search by using keywords. The supported keywords are:
    • j : project name
    • d : build dispaly name
    • p : build parameter
    • n : build number
    • c : build console log

For example, if you want to search for builds in the job "test1", which have "1" in its display name and "bash" in its console log, the query should be "test1 d:1 c:bash". If you want to search for all builds whose display name starts with "linux" or ends with "linux", the query should be "linux* OR *linux".

image

image

Search Result

The highlighted fragments will not show if your search range does not include the console content.

The 'm' button will take you to the middle and 'b' to the bottom.

Customize the Plug-in

You can customize Lucene Search according to your needs. For example. if you want to add your own word delimiters, you can modify CaseInsesitiveAnalyzer class and add delimiters.

For more information on the query syntax, you can consult Apache Lucene Query Parser Syntax.

Version

Please download release version 358.vf0bb3a3ef215 or other newer version. The old versions might not work properly.

lucene-search-plugin's People

Contributors

dependabot[bot] avatar hanabishi avatar hmarkc avatar notmyfault avatar tdraebing avatar thomasdraebing avatar tobias- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lucene-search-plugin's Issues

Searching for build number on builds fail

The Jenkins link from the default Jenkins search plugin when standing on a build and searching for a build number will result in a broken link
When standing in job and searching for a build on that job.
https:///1955

Adopting the lucene-search plugin

Hello @hmarkc, @tobias-, @hanabishi,

some months ago, I started using the lucene-search plugin as a dependency of one of my own plugins (gerrit-checks-api), since I needed an index and didn't want to reinvent the wheel. For this purpose, I also fixed the existing security issues and created to other PRs to enable Java 11 support (required for newer Jenkins versions) and to make the search in the UI optional, basically making the index only usable by other plugins. Those PRs are by now open for a very long time. For me to be able to use my own plugin, I would need these PRs to be merged.
If you are not actively working on this plugin anymore and can't support it, I would like to adopt it or become an additional maintainer. Would this be OK from your side?

Thanks and best regards,
Thomas

search doesn't find builds for jobs in folders

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.

Using insecure version of solr

CVE-2017-12629
CVE-2017-3163
CVE-2017-12629

All these apply to the plugin with the current version (5.3.1). They are heavily mitigated as the plugin itself is the only one accessing the solr, but it could affect someone, so upgrading this would be good.

This plugin has development is frozen, so it'll need to be a third part.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.