How to Index (add Field) the word position from text file into Indexing file Using Lucene

2015-11-27 Thread Muhammad Adnan
Hi,
i am new in lucene environment and lean from web tutorial
http://www.tutorialspoint.com/lucene/lucene_first_application.htm. 
1- Indexer.java class is used to index the raw data so that we can make it
searchable using lucene library. 2- LuceneConstants.java class is used to
provide various constants to be used across the sample application.
3- Searcher.java class is used to search the indexes created by Indexer to
search the requested contents. 4- TextFileFilter.java class is used as a
.txt file filter. 
5- LuceneTester.java lass is used to test the indexing and search capability
of lucene library..

Now I am trying to index the Field for word position (TermVectorPosition) in
Indexer.java  file and  retrieve it through query.  Any one help me




--
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-Index-add-Field-the-word-position-from-text-file-into-Indexing-file-Using-Lucene-tp4242471.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



Determine whether a MatchAllQuery or a Query with atleast one Term

2015-11-27 Thread Sandeep Khanzode
Hi,
I have a question.
In my program, I need to check whether the input query is a MatchAll Query that 
contains no terms, or a Query (any variant) that has at least one term. For 
typical Term queries, this seems reasonable to be done with 
Query.extractTerms(Set<> terms) which gives the list of terms. 
However, when there is a NumericRangeQuery, this method throws an 
UnsupportedOperationException.
How can I determine that a NumericRangeQuery or any non-Term query exists in 
the Input Query and differentiate it from the MatchAllQuery? -- SRK

Wildcard Terms and total word or phrase count

2015-11-27 Thread Kunzman, Douglas *
Hi -

This is my first Lucene project, my other search projects have used Solr.
I would like to find the total number of WildCard terms in a set of documents 
with 0-N matches per document.
I would prefer not have to open each document where a match is found.  I need 
to be able to support wildcards but my requirements are somewhat flexible in 
about phrase search support.
Whatever is easier.

This is what I have so far.

   public static void main(String args[]) throws IOException, ParseException {
Directory idx = FSDirectory.open(path);
index("C:\\Users\\Douglas.Kunzman\\Desktop\\test_index");

Term term = new Term("Doc", "quar*");

WildcardQuery wc = new WildcardQuery(term);

SpanQuery spanTerm = new SpanMultiTermQueryWrapper(wc);
IndexReader indexReader = DirectoryReader.open(idx);

System.out.println("Term freq=" + indexReader.totalTermFreq(term));
System.out.println("Term freq=" + 
indexReader.getSumTotalTermFreq("Doc"));

IndexSearcher isearcher = new IndexSearcher(indexReader);

IndexReaderContext indexReaderContext = isearcher.getTopReaderContext();
TermContext context = TermContext.build(indexReaderContext, term);
TermStatistics termStatistics = isearcher.termStatistics(term, context);
System.out.println("termStatics=" + termStatistics.totalTermFreq());
}

Does anyone have any suggestions?  totalTermFreq is zero, but when search using 
quartz we find matches.
I'm searching the Quartz user's guide as an example.

Thanks,
Doug







Re: Determine whether a MatchAllQuery or a Query with atleast one Term

2015-11-27 Thread Michael Wilkowski
Instanceof?

MW
Sent from Mi phone
On 28 Nov 2015 06:57, "Sandeep Khanzode" 
wrote:

> Hi,
> I have a question.
> In my program, I need to check whether the input query is a MatchAll Query
> that contains no terms, or a Query (any variant) that has at least one
> term. For typical Term queries, this seems reasonable to be done with
> Query.extractTerms(Set<> terms) which gives the list of terms.
> However, when there is a NumericRangeQuery, this method throws an
> UnsupportedOperationException.
> How can I determine that a NumericRangeQuery or any non-Term query exists
> in the Input Query and differentiate it from the MatchAllQuery? -- SRK