lucene group bobo-Browse to sort the problem

sponsored links
Encountered a problem today with bobo grouped in ascending price actually two standing in the front than the 1000. Obviously it is a string sort.

100

1000

2

20

201

Then I went online to find a moment in this regard the article, the basic not be found. No option but to look at their source. Silly very naive BrowseRequest found in setFacetSpecO (String name, FacetSpec facetSpec) method. FacetSpec class have setOrderBy (FacetSortSpec order) method.

When the order = FacetSortSpec.OrderByCustom can be customized to sort by.

Call setCustomComparatorFactory (ComparatorFactory comparatorFactory); when I wrote a method to achieve after ComparatorFactory interface. Indeed achieved a sort, but only achieved a sort of grouping fields. Carefully looked at the code, the original starting point of my wrong. This class has always been a class action group. I would like to sort the results with the present is not here. Then I went to read under the lucene source. Found FieldSortedHitQueue this class, this class is the class to sort the results. Similarly, in the bobo, I also hit the LuceneSortDocComparatorFactory, but there had to say something a little problem. In the bobo in it if you do not set the default sorting rules, so it will not enter LuceneSortDocComparatorFactory category. It is the default sort in SimpleFacetHandler under getScoreDocComparator (). The getScoreDocComparator return is FacetDataCache the getScoreDocComparator (), how to do it. The simplest is to write their own class inheritance SimpleFacetHandler. The getScoreDocComparator return to the null, said that with the use of lucene sort. Well basically the problem here has been resolved.

If you have any questions and what advice can give me a message.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of lucene group bobo-Browse to sort the problem

  • Hibernate access picture sample

    General web users to upload picture at treatment would normally uses two types of strategies: First, put directly into the picture in the database Blob field; II database are stored only at the picture on the path of the server information?, Pictures stor

  • Ruby Symbol

    Ruby is a completely cross-platform object-oriented scripting language, built on the Ruby-based Web framework Ruby on Rails (ROR) is the field of web development is gaining increasing acceptance. ROR substantial use of the Ruby language features, Symbol i

  • hibernate study of the fifth chapter

    1, oracle database, user is the keyword, if a user table named user will give rise to conflicts. The approach taken in the main have two kinds: ① If you can modify the table name, it is best to change the table name tuser or other name, to avoid causing t

  • hibernate the third study (mapping file configuration)

    If you do not want to use the default hibernate.cfg.xml file as a configuration file, we can also specify the configuration file name: File file = new File ( "C: \ \ myhibernate.xml"); Configuration config = new Configuration (). Configure (file

  • Can you understand programming you XP

    Agile Extreme Programming XP and RUP (ROSE provide large-scale software development "methodology") are two kinds of software development methodology. Great design is a use of all resources, from the entire field of thought to the design of ...

  • Hibernate query: HQL and Criteria

    HQL query methods generally used in more general way through the query query. Examples are as follows: The Criteria is a more than HQL query object-oriented approach: Created as follows: Criteria crit = session.createCriteria (Object.class); crit.add ...

  • Hibernate Inteceptor

    The end of the project stage, the client suddenly put forward a very troublesome but normal demand, the system records all changes must be carried out. Formats such as: 2004.1.1 12:30 Ikuya wind orders Sales Order Date 2004.1.2-> 2004.1.3 The firs ...

  • hibernate call stored procedure

    hibernate call stored procedure

  • Based on Spring's Hibernate Search full-text search function of sample

    Database: Oracle 9i JDBC Driver: OJDBC14 Development Environment: Eclipse-JEE Spring version: Spring 2.0.6 Hibernate version: Hibernate Core 3.2.5/Hibernate Annotation 3.3.0/Hibernate Validator 3.0.0/Hibernate Search 3.0.0 Beta4 / / jdbc.properties (JDBC

  • The level Hibernate cache

    Hibernate cache level: (1) a cache is very short and the session life cycle consistent, also known as session-level cache-level cache or transaction-level cache (2) Ways of Supporting level cache: get (); load (); iterator (); only entity object cach ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries