Re: Storing and retrieving Java objects in Lucene

2018-02-19 Thread ganesh m
Hi Santosh >>Furthermore converting the Lucene Documents to Java object and vice- versa is a tedious task. This should not be tedious, how big your document is? One suggestion is to convert your Java object to JSON and store it in Lucene. You need to retrieve one field and you can easily

Storing and retrieving Java objects in Lucene

2018-02-19 Thread Kumar, Santosh
Hi, I have a requirement to store a Java object with multiple fields into the Lucene index. Basically, at the application startup I run a select query on entities ( there are 5 of them as of now and may increase in future) and then create an index for each of these entities (5) i.e. five

Re: Storing and retrieving Java objects in Lucene

2018-02-19 Thread Kumar, Santosh
Hi Ganesh, Thank you for quick response. Most of these documents will have more than 10 fields. In some cases there is also a foreign key relationship. Will consider JSON. Also need to consider performance factor. Thank you and Regards, Santosh On 20/02/18, 10:00 AM, "ganesh m"

Read DocValue twice

2018-02-19 Thread Vadim Gindin
Hi all I use DocValue for scoring function. I.e. I have some column with integers, that are used in scoring formula. So I have a scorer that calculates scoring function twice: - in score() - in explain() I got the following error in explain: Caused by: java.lang.IndexOutOfBoundsException

Re: Read DocValue twice

2018-02-19 Thread Adrien Grand
Can you add some debug logging to see what the values of topList.doc and reader.maxDoc() are before before you call advanceExact? What do you mean by "I reuse the same DisiPriorityQueue of scorers in score() and explain()". This shouldn't be possible. Le lun. 19 févr. 2018 à 15:23, Vadim Gindin

Re: Read DocValue twice

2018-02-19 Thread Vadim Gindin
I have the scorer that is similar to DisjunctionScorer.java with private final DisiPriorityQueue subScorers; private final DisjunctionDISIApproximation approximation; They are initialized in a constructor like that: this.subScorers = new DisiPriorityQueue(subScorers.size()); for (Scorer

Re: Read DocValue twice

2018-02-19 Thread Vadim Gindin
I use these calls in both cases. In score() and explain() I have the following code: SortedNumericDocValues numDocVal = DocValues.getSortedNumeric(reader, fieldName); if (numDocVal != null && numDocVal.advanceExact(topList.doc)) { long val = numDocVal.nextValue(); .. } I reuse the same

Re: Read DocValue twice

2018-02-19 Thread Adrien Grand
If you want to read the values again, you need to call setDocument (Lucene < 7.0) or advanceExact (Lucene >= 7.0) before calling nextValue(). Le lun. 19 févr. 2018 à 14:41, Vadim Gindin a écrit : > Hi all > > I use DocValue for scoring function. I.e. I have some column

Re: Read DocValue twice

2018-02-19 Thread Adrien Grand
Yes, this is the problem. This doc ID is a special sentinel value that means that the iterator is exhausted. I don't have enough context to know what the exact problem is but there is a bug in your custom query. Le lun. 19 févr. 2018 à 16:07, Vadim Gindin a écrit : > I