You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mufaddal Khumri <MK...@allegromedical.com> on 2005/04/15 09:48:14 UTC

Problem when searching ..

Hi,

I am creating an index of my data that's persisted by Hibernate using
Lucene. I am running my indexer on a huge data set. My indexing takes
1312805ms. At the end of which I get a 26,266KB directory. 

I can view the contents of my index directory using Luke.

When I copy my webapp under Tomcat and try to search on it I get the
following exception:

java.io.FileNotFoundException: C:\Program Files\Apache Software
Foundation\Tomcat 5.5\webapps\tan\tan-search-index\_33.fnm (The system
cannot find the file specified)
	java.io.RandomAccessFile.open(Native Method)
	java.io.RandomAccessFile.<init>(Unknown Source)
	
org.apache.lucene.store.FSInputStream$Descriptor.<init>(FSDirectory.java
:376)
	
org.apache.lucene.store.FSInputStream.<init>(FSDirectory.java:405)
	
org.apache.lucene.store.FSDirectory.openFile(FSDirectory.java:268)
	org.apache.lucene.index.FieldInfos.<init>(FieldInfos.java:53)
	
org.apache.lucene.index.SegmentReader.initialize(SegmentReader.java:109)
	
org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:94)
	
org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:122)
	org.apache.lucene.store.Lock$With.run(Lock.java:109)
	org.apache.lucene.index.IndexReader.open(IndexReader.java:111)
	org.apache.lucene.index.IndexReader.open(IndexReader.java:95)
	
org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:38)
	
com.ac.t.managers.SearchManagerImpl.search(SearchManagerImpl.java:233)
	com.ac.t.web.actions.search.Search.work(Search.java:42)
	com.ac.t.web.actions.TanAction.execute(TanAction.java:51)
	
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:421)
	
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
226)
	
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.j
ava:39)
	
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.
java:118)
	
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.j
ava:52)
	
com.ac.t.web.filters.HibernateSessionFilter.doFilter(HibernateSessionFil
ter.java:41)

This is the code of my com.ac.t.managers.SearchManagerImpl.search
function:

	public Hits search(String indexPath, String queryString, String
entity)
		throws IOException, ParseException
	{
		IndexSearcher indexSearcher = new
IndexSearcher(indexPath); <--This is the line where it throws the
exception.

		if(queryString == null) 
		  queryString = "";

		Query query1 =
QueryParser.parse(queryString,"content",analyzer);
		
		Term term = null;
		if(entity.equals("product"))
		  term = new Term("entity","product");
		else
		if(entity.equals("category"))
		  term = new Term("entity","category");
		  
		TermQuery query2 = new TermQuery(term); 
		BooleanQuery bq = new BooleanQuery();
		bq.add(query1, true, false);
		bq.add(query2, true, false);
		
		log.debug(query1.toString());
		log.debug(query2.toString());
		log.debug(bq.toString());

		return indexSearcher.search(bq);
	}


What am I doing wrong while searching? Why is the exception being
thrown? 

Mufaddal.

------------------------------------------------------------------------------------------
This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity 
to whom they are addressed. If you have received this 
email in error please notify the system manager. Please
note that any views or opinions presented in this email 
are solely those of the author and do not necessarily
represent those of the company. Finally, the recipient
should check this email and any attachments for the 
presence of viruses. The company accepts no liability for
any damage caused by any virus transmitted by this email.
Consult your physician prior to the use of any medical
supplies or product.
------------------------------------------------------------------------------------------


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


Re: Problem when searching ..

Posted by Brisbart Franck <Fr...@kelkoo.net>.
Did you have a look at this thread ??
http://mail-archives.eu.apache.org/mod_mbox/jakarta-lucene-dev/200401.mbox/%3c40056471.5020704@jivesoftware.com%3e
It may help you

Franck

Mufaddal Khumri wrote:
> Hi,
> 
> I am creating an index of my data that's persisted by Hibernate using
> Lucene. I am running my indexer on a huge data set. My indexing takes
> 1312805ms. At the end of which I get a 26,266KB directory. 
> 
> I can view the contents of my index directory using Luke.
> 
> When I copy my webapp under Tomcat and try to search on it I get the
> following exception:
> 
> java.io.FileNotFoundException: C:\Program Files\Apache Software
> Foundation\Tomcat 5.5\webapps\tan\tan-search-index\_33.fnm (The system
> cannot find the file specified)
> 	java.io.RandomAccessFile.open(Native Method)
> 	java.io.RandomAccessFile.<init>(Unknown Source)
> 	
> org.apache.lucene.store.FSInputStream$Descriptor.<init>(FSDirectory.java
> :376)
> 	
> org.apache.lucene.store.FSInputStream.<init>(FSDirectory.java:405)
> 	
> org.apache.lucene.store.FSDirectory.openFile(FSDirectory.java:268)
> 	org.apache.lucene.index.FieldInfos.<init>(FieldInfos.java:53)
> 	
> org.apache.lucene.index.SegmentReader.initialize(SegmentReader.java:109)
> 	
> org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:94)
> 	
> org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:122)
> 	org.apache.lucene.store.Lock$With.run(Lock.java:109)
> 	org.apache.lucene.index.IndexReader.open(IndexReader.java:111)
> 	org.apache.lucene.index.IndexReader.open(IndexReader.java:95)
> 	
> org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:38)
> 	

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