Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
spring-lucene - Searching very slow Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-lucene - Searching very slow

    I have an application using spring-modules 0.8 and Spring 2.0.6. Indexing worked fine and I now have a 1.2 gb index of about 2 million documents.

    Searching in the deployed application is VERY slow - 5-15 seconds to perform a search.

    However, I created a unit test with multiple index searches and found that the searches were only taking a few milliseconds to complete.

    Based on this, my current suspicion is that the Searcher is being closed between requests and the delay is in opening a new Searcher. Is this possible? What else could possibly be wrong? Code below:

    applicationContext.xml:
    Code:
    <bean id="fsDirectory" class="org.springmodules.lucene.index.support.FSDirectoryFactoryBean">
    	    <property name="location" value="file:/var/lucene"/>
    </bean>
    
    <bean id="indexFactory" class="org.springmodules.lucene.index.support.SimpleIndexFactoryBean">
        	<property name="directory" ref="fsDirectory"/>
        	<property name="analyzer">
            	<bean class="org.apache.lucene.analysis.SimpleAnalyzer"/>
        	</property>
    </bean>
    	
    <bean id="searcherFactory" class="org.springmodules.lucene.search.factory.SimpleSearcherFactory">
        	<property name="directory" ref="fsDirectory"/>
    </bean>
    
    <bean id="indexWriter" class="com.xyz.lucene.impl.IndexWriterImpl">
           <property name="indexFactory" ref="indexFactory"/>
    </bean>
    	
    <bean id="indexSearcher" class="com.xyz.lucene.impl.IndexSearcherImpl">
    	<property name="searcherFactory" ref="searcherFactory"/>
    	<property name="analyzer">
        		<bean class="org.apache.lucene.analysis.SimpleAnalyzer"/>
      	</property>
    </bean>
    My Searcher:
    Code:
    public LuceneHits getArticles(final String textToSearch) throws ParseException, IOException {
    		String[] queries = new String[] {textToSearch,textToSearch};
    		return this.getSearcherFactory().getSearcher().search(MultiFieldQueryParser.parse(queries, new String []{"articleTitle","articleText"}, new SimpleAnalyzer()));
    		
    
    	}
Working...
X