Can someone help me finding the word frequency in all lucene index
for example if doc A has 3 number of word (B) and doc C has 2 of them, I'd like a method to return 5 showing the frequency of word (B) in all lucene index
相关问题
- What is the best way to do a search in a large fil
- JCR-SQL - contains function doesn't escape spe
- Search Multiple Arrays for
- Find index given multiple values of array with Num
- Google Custom Search Engine not giving the expecte
相关文章
- What is the complexity of bisect algorithm?
- Solr - _version_ field must exist in schema and be
- Visual Studio: Is there an incremental search for
- How do I hide a site from search engines? [closed]
- Why is C# Array.BinarySearch so fast?
- Find three elements in a sorted array which sum to
- TreeMap - Search Time Complexity
- performance for searching through 100 million reco
Assuming you work with Lucene 3.x:
Some comments:
dir
is the instance of Lucene Directory class. It's creation differs for RAM and Filesystem indexes, see Lucene documentation for details."your_filed"
is a filed to search a term. If you have multiple fields, you can run procedure for all of them or, alternatively, when you index your files, you can create special field (e.g. "_content") and keep there concatenated values of all other fields.This has been asked multiple times:
using lucene 3.4
easy way to get the count, but you need two arrays :-/
beware: if you would use for read you are not able to use next() any more, because after the read() you are already at the end of the enumeration: