lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Lauwers <Jeroen.Lauw...@CTLO.NET>
Subject RE: Indexing the multiple words at the same position
Date Fri, 06 Aug 2010 12:07:32 GMT
Hi, Daniele

That's it! You put me on the right track!
I found the answer in "" where
they talk about a "Custom Synonym Analyzer". The final clue was "Token.SetPositionIncrement(0)".
I never realized it was as simple as manipulating the SetPositionIncrement of the token your
about to add in the "next()" method.


-----Original Message-----
From: Daniele Fusi [] 
Sent: vrijdag 6 augustus 2010 12:30
Subject: RE: Indexing the multiple words at the same position

Hi, it also depends on the complexity of your critical apparatus, but you
could just use a custom analyzer which injects "synonyms" (here variants) of
your tokens in THE SAME POSITION as the original word. This way a search
will match both "daddy" and "happy".

-----Original Message-----
From: Jeroen Lauwers [mailto:Jeroen.Lauwers@CTLO.NET] 
Sent: venerdì 6 agosto 2010 12:24
Subject: Indexing the multiple words at the same position

Has anyone encountered the following problem (and found a solution)

I need to index a classical text that can have multiple words at that same
position. Example: if a publisher isn't sure if Shakespeare wrote "To be or
not to be happy" or "To be or not to be daddy", he will put the 'best' word
(eg. 'happy') in the full text and the second option (eg. 'daddy') in the
"notes" at the bottom of a page.
Now, our customer wants to search for "to be daddy" and find "to be happy".
So, if I could index "daddy" at the same position as "happy" , I would be
very happy too.

Of course you can think of a solution where one would index the full text
for each version, but this is not sustainable when the number of "multiple
occupation of a single position" increase.

I have been looking at the 'next()' method of the 'Tokenizer' class, but I
haven't found the solution (yet).

Thanks in advance to all who reply.

View raw message