neal.granroth at thermofisher
Jun 23, 2011, 10:33 AM
Post #2 of 2
That's an intriguing problem which you are trying to solve.
RE: how to approach phrase queries and term grouping
[In reply to]
If you have the ability to programmatically alter the search,
one possibility would be to revise it to be
("Ship Creek" OR "Ship Ck" OR "Ship Cr")
that would avoid the problem of intervening words.
Using a custom TokenFiler in order to tokenize [Ship Creek] and [Bird Creek] might cause you trouble because it would then no longer be possible to search by the words "ship", "bird", or "creek" individually.
An alternative might be to enhance the index entries for each booklet with a
"geographical location" field containing standardized phrases in place of the various synonyms of the locations from your list of place names.
Then when running a search you'd then submit something like: (trout AND placename:(Ship_Creek OR Bird_Creek))
Doing it this way the user would still have the flexibility to use the individual words "ship", "bird", or "creek" in content searches if needed.
From: Jason Guild [mailto:jason.guild [at] alaska]
Sent: Wednesday, June 22, 2011 7:26 PM
To: general [at] lucene
Cc: java-user [at] lucene
Subject: how to approach phrase queries and term grouping
I am new to Lucene and my project is to provide specialized search for a
of booklets. I am using Lucene Java 3.1.
The basic idea is to run queries to find out what booklet and page
match in order to help people know where to look for information in the
large and dry) booklets. Therefore each Document in my index represents a
particular page in one of the booklets.
So far I have been able to successfully scrape the raw text from the
insert it into an index, and query it just fine using StandardAnalyzer
So here's my general question:
Many queries on the index will involve searching for place names
mentioned in the
booklets. Some place names use notational variants. For instance, in the
it will be called "Ship Creek" but in a diagram it might be listed as
"Ship Cr." or
elsewhere as "Ship Ck.".
If I search for (Ship AND (Cr Ck Creek)) this does not give me what I
other words may appear between [ship] and [cr]/[ck]/[creek] leading to
What I need to know is how to approach treating the two consecutive
words as a single
term and add the notational variants as synonyms. So, in a nutshell I
need the basic
stuff provided by StandardAnalyzer, but with term grouping to emit place
as complete terms and insert synonymous terms to cover the variants.
For instance, the text "...allowed from the mouth of Ship Creek upstream
to ..." would
result in tokens [allowed],[mouth],[ship creek],[upstream]. Perhaps via
a TokenFilter along
the way, the [ship creek] term would expand into [ship creek][ship
As a bonus it would be nice to treat the trickier text "..except in
Ship, Bird, and
Campbell creeks where the limit is..." as [except],[ship creek],[bird
Should the detection and merging be done in a TokenFilter?
Some of the term grouping can probably be done heuristically [*],[creek]
is [* creek]
but I also have an exhaustive list of places mentioned in the text if
Thanks for any help you can provide.