Forums / Extensions / eZ Find / ezFind 2.2 - sort by name issue

ezFind 2.2 - sort by name issue

Author Message

Fabien Mas

Wednesday 30 June 2010 12:59:01 am

Hello, I have just installed ezfind 2.2 and I have this issue : if I sort by name I have an error :

Got invalid result from search engine.<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body><h2>HTTP ERROR: 500</h2><pre>there are more terms than documents in field "meta_name_t", but it's impossible to sort on tokenized fields

java.lang.RuntimeException: there are more terms than documents in field "meta_name_t", but it's impossible to sort on tokenized fields
 at org.apache.lucene.search.FieldCacheImpl$StringIndexCache.createValue(FieldCacheImpl.java:706)
 at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:208)
 at org.apache.lucene.search.FieldCacheImpl.getStringIndex(FieldCacheImpl.java:676)
 at org.apache.lucene.search.FieldComparator$StringOrdValComparator.setNextReader(FieldComparator.java:667)
 at org.apache.lucene.search.TopFieldCollector$OneComparatorNonScoringCollector.setNextReader(TopFieldCollector.java:94)
 at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:253)
 at org.apache.lucene.search.Searcher.search(Searcher.java:171)
 at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:988)
 at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:884)
 at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341)
 at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:178)
 at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
 at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
 at org.apache.solr.core.SolrCore.execute(SolrCore.java:1321)
 at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:341)
 at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:244)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
 at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
 at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
 at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
 at org.mortbay.jetty.Server.handle(Server.java:285)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
 at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:835)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:641)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:202)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
 at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
 at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
</pre>
<p>RequestURI=/solr/select</p><p><i><small><a href="http://jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                

</body>
</html>

If I change and sort by path, it works

Here is my query :

{def $params=hash( 'query', $searchtext,
                             'limit',$limit,
                              'sort_by', hash('name', 'asc'),                              
                              'offset',$offset,
                              'subtree_array', array($node.node_id),
                              'class_id',$classid)}       
{def $resultats=fetch( 'ezfind', 'search',$params)}


Thx, Fabien

Ivo Lukac

Wednesday 30 June 2010 1:23:29 am

Seems like a bug...

And it is: http://issues.ez.no/IssueView.php?Id=15423&activeItem=1

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Fabien Mas

Wednesday 30 June 2010 2:07:38 am

Ok

I have to wait then :)

thanks for your help

Ivo Lukac

Wednesday 30 June 2010 6:20:26 am

You can write a comment on that issue. Then developers will know that more people have that problem and maybe they speed up resolving.

Maybe :)

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Paul Borgermans

Monday 05 July 2010 11:00:48 am

Indeed,

The default field type for the "name" meta data is "text" which cannot be used to sort (it is split in multiple terms which causes the error you see)

However the following recipe will help you:

You can add a schema definition in schema.xml that does a copyfield from "meta_name_t" to "meta_name_s" (of type string) and use the latter for sorting

So in schema.xml add a new field definition in the <fields> section

 <field name="meta_name_s" type="string" indexed="true" stored="false" />

Then add a copyfield construct:

 <copyField source="meta_name_t" dest="meta_name_s"/>

Finally reindex your site (needed with amost all schema changes) and then modify your fetch functions as follows:

{def $params=hash( 'query', $searchtext,
                             'limit',$limit,
                              'sort_by', hash('meta_name_s', 'asc'),                              
                              'offset',$offset,
                              'subtree_array', array($node.node_id),
                              'class_id',$classid)}       
{def $resultats=fetch( 'ezfind', 'search',$params)}

That should be it

hth

Paul

PS: from eZfind 2.3 it should not be needed to do this as you can already do for regular attributes: specify different field types for search, sort, facet and filter

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

eZ debug

Timing: Jan 17 2025 23:37:15
Script start
Timing: Jan 17 2025 23:37:15
Module start 'content'
Timing: Jan 17 2025 23:37:16
Module end 'content'
Timing: Jan 17 2025 23:37:16
Script end

Main resources:

Total runtime0.8853 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.8359180.7813
Module start 'content' 0.00650.7470 768.6172634.1563
Module end 'content' 0.75350.1318 1,402.7734341.3984
Script end 0.8853  1,744.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4524210.0002
Check MTime0.00160.1789210.0001
Mysql Total
Database connection0.00070.075510.0007
Mysqli_queries0.806291.06572050.0039
Looping result0.00190.21902030.0000
Template Total0.855696.620.4278
Template load0.00210.233820.0010
Template processing0.853596.402420.4267
Template load and register function0.00030.038610.0003
states
state_id_array0.00080.088910.0008
state_identifier_array0.00110.121620.0005
Override
Cache load0.00170.1954370.0000
Sytem overhead
Fetch class attribute can translate value0.00160.178840.0004
Fetch class attribute name0.00170.187770.0002
XML
Image XML parsing0.00150.163940.0004
class_abstraction
Instantiating content class attribute0.00000.001880.0000
General
dbfile0.00640.7275350.0002
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs