Access to the TermEnum collection outside OAL package

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Access to the TermEnum collection outside OAL package

bogdan71
  Hello,

  I'm indexing a collection of terms representing asset names(computer models, printers,
peripherals and so on). However, the entire collection lies in just 1(one) document.
I need to match terms given in an outer file against the ones stored in the index, returning
the best matches and their scores(similarity values).

  I did like this:
  - for each term to find, build a FuzzyQuery object like this:
       fq = new FuzzyQuery(new Term("contents", queryString), minSimilarity)
  - as the FuzzyQuery.getEnum() method is protected - and my program is
     in another package, I added a getEnumWrapper() method to the FuzzyQuery
     class. It does the same as getEnum() - returns a FilteredTermEnum collection
     but it's public.
  - finally, the program iterates through all the items returned by getEnumWrapper()
     displaying the best matches.

  My question is: can I have access outside of the OAL(org.apache.lucene) package
to the TermEnum collection WITHOUT adding getEnumWrapper() ?

  Bogdan
Reply | Threaded
Open this post in threaded view
|

Re: Access to the TermEnum collection outside OAL package

hossman

:   I did like this:
:   - for each term to find, build a FuzzyQuery object like this:
:        fq = new FuzzyQuery(new Term("contents", queryString), minSimilarity)
:   - as the FuzzyQuery.getEnum() method is protected - and my program is
:      in another package, I added a getEnumWrapper() method to the FuzzyQuery
:      class. It does the same as getEnum() - returns a FilteredTermEnum
: collection
:      but it's public.
:   - finally, the program iterates through all the items returned by
: getEnumWrapper()
:      displaying the best matches.

it sounds like you aren't executing the FuzzyQuery at all ... just
enumerating over theterms, correct?

Do you really need the FuzzyQuery object at all?
why not just construct a FuzzyTermEnum directly? (it's a public class).


BTW...
   http://people.apache.org/~hossman/#java-dev
Please Use "java-user@lucene" Not "java-dev@lucene"

Your question is better suited for the java-user@lucene mailing list ...
not the java-dev@lucene list.  java-dev is for discussing development of
the internals of the Lucene Java library ... it is *not* the appropriate
place to ask questions about how to use the Lucene Java library when
developing your own applications.



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]