is there any sample plugin code for Data center which uses the lucene index

Harsh Dubey-Admin March 20, 2019

Hello Team,
I want to index plugin specific data in lucene & use it for the searching just like the way search issue of jira.
is there any sample plugin for Data center which uses the lucene index ?
my requirement is specific to jira data center.

Thanks,
Harsh

1 answer

0 votes
Maciej Swinarski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 1, 2019

Hi, is this data related to issue?

If yes the solution are custom fields and this works "for free" in DC. 

If a plugin wants to have its own index, then Jira does not provide any service for such functionality and this would require some significant amount of work to make it work in DC. 

Please let me know what kind of data you need to index?

mac

Harsh Dubey-Admin April 2, 2019

Hello Mac,

Thanks for your reply.
I'm developing an addon which needs some data to be indexed in order to fast & efficient text based search (just like jira does for search issue) using lucene.

If there is a sample plugin which is leveraging the lucene for text based search & working in jira DC environment then it can help me to solve the usecase.
Let me know if you need any more details.


Thanks,
Harsh

Maciej Swinarski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2019

Hi Hash,

I still would like to know if this data is related to issues. 

Also you wrote:

 use it for the searching just like the way search issue 

Do you mean search it via JQL or directly using Lucene. 

mac

Harsh Dubey-Admin April 2, 2019

Hello Mac,

The data is related to my addon, I will index following details from jira issue id, project id & version id. 

I have to implement my own version of query language i.e. directly using lucene. you can say that similar like JQL.

For eg, using my addon if I will search projectId = 10000 & samplePluginKey="info" then it should return the matched data.

Thanks,

Harsh

Maciej Swinarski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2019

If this data is related to issue, why not make it part of the existing issue index?

With your own index there are few challenging problems you will have to solve in DC:

* take care of replicating the indexing operation on all other nodes (Jira is currently communicating this via the DB but this may change in future)

* by default in Jira >= 8.0 runs with periodic commits so you would need to take care of replaying the index operations which did not make it into the index on previous shutdown (applies to this and all other nodes)

These are just the biggest problems you would need to take care of. 

I would really discourage you from taking this path.

mac

Harsh Dubey-Admin April 2, 2019

I'm not sure, if I can use the jira index because I have lot of other information.
I have finalized the strategy on replicating index on other nodes by inserting data in database & polling the database at other nodes.
I just wanted to check how the jira lucene setup works & I can implement in the similar way. Really appreciate your help if I can get some documentation on how jira indexing works at code level.

Thanks,
Harsh

Maciej Swinarski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2019

Hi Harsh, 

Jira doesn't provide any API for such functionality. We can't really enforce it but we strongly recommend plugins to stick to use the existing API. 

If a plugin would create a Lucene index - it will be responsible for the whole lifecycle of the index: creating, replicating, replaying on start, automatic index distribution (after full re-index on one node, when new node joins the cluster), backing up etc. This is not part of the JIRA API, so would have to be handled by the plugin itself.  Not sure how can I help you with this. This is a huge subject.

Is this an internal plugin? If you have control over the infrastructure maybe you could use an external indexing service for the plugin data. This would resolve many of the index lifecycle problems which needs to be solved with local Lucene indexes in a Jira DC environment. 

mac

Harsh Dubey-Admin April 9, 2019

Hello Mac,

I understand that I have to manage the complete lifecycle from creating to replicating to other nodes & covering the edge cases like node rejoins the cluster/ node restarts/ backup-recovery / syncing of node.

I have to develop a plugin which can leverage lucene for text based search. I don't have control over external indexing search tool.
As said above, I need some reference to use lucene in DC environment. As I can see Jira utilizes the lucene for jira-issue data so I thought I can get some lead in developing the plugin.

Thanks,
Harsh

Suggest an answer

Log in or Sign up to answer