Solr
  1. Solr
  2. SOLR-1156

Sort TermsComponent results by frequency

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.4
    • Component/s: None
    • Labels:
      None

      Description

      TermsComponent should be able to return results sorted by frequency.

      1. SOLR-1156.patch
        9 kB
        Matt Weber
      2. SOLR-1156.patch
        4 kB
        Matt Weber
      3. SOLR-1156.patch
        4 kB
        Matt Weber
      4. SOLR-1156.patch
        4 kB
        Matt Weber

        Issue Links

          Activity

          Hide
          Grant Ingersoll added a comment -

          Bulk close for Solr 1.4

          Show
          Grant Ingersoll added a comment - Bulk close for Solr 1.4
          Hide
          Yonik Seeley added a comment -

          Committed. Thanks Matt!
          It would be great if you could update the docs on the wiki too.

          Show
          Yonik Seeley added a comment - Committed. Thanks Matt! It would be great if you could update the docs on the wiki too.
          Hide
          Yonik Seeley added a comment -

          Looks simple enough - I'll commit soon if there are no objections.

          Show
          Yonik Seeley added a comment - Looks simple enough - I'll commit soon if there are no objections.
          Hide
          Matt Weber added a comment -

          SOLR-1177 includes this patch.

          Show
          Matt Weber added a comment - SOLR-1177 includes this patch.
          Hide
          Matt Weber added a comment -

          Added some unit tests.

          Show
          Matt Weber added a comment - Added some unit tests.
          Hide
          Matt Weber added a comment -

          The current tests pass:

          [junit] Running org.apache.solr.handler.component.TermsComponentTest
          [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 6.944 sec

          I will work on some unit tests for the new sorting functionality.

          Show
          Matt Weber added a comment - The current tests pass: [junit] Running org.apache.solr.handler.component.TermsComponentTest [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 6.944 sec I will work on some unit tests for the new sorting functionality.
          Hide
          Yonik Seeley added a comment -

          It would be nice for this to have some tests before it's committed
          Actually, does this pass the current tests since the default sort order was changed and the tests weren't changed? perhaps if the current tests are small enough and never test for order of results, they do still pass?

          Show
          Yonik Seeley added a comment - It would be nice for this to have some tests before it's committed Actually, does this pass the current tests since the default sort order was changed and the tests weren't changed? perhaps if the current tests are small enough and never test for order of results, they do still pass?
          Hide
          Matt Weber added a comment -

          Updated to use BoundedTreeSet instead of a regular TreeSet. Don't know why I didn't use this in the first place.

          Show
          Matt Weber added a comment - Updated to use BoundedTreeSet instead of a regular TreeSet. Don't know why I didn't use this in the first place.
          Hide
          Yonik Seeley added a comment -

          Thanks Matt!
          This should probably use a BoundedTreeSet or a PriorityQueue to avoid keeping (and ordering) all of the terms in memory?

          Show
          Yonik Seeley added a comment - Thanks Matt! This should probably use a BoundedTreeSet or a PriorityQueue to avoid keeping (and ordering) all of the terms in memory?
          Hide
          Matt Weber added a comment -

          Updated patch to resolve conflicts with the recent changes to trunk (rev. 773446). Also to keep the sort parameter similar to the facet.sort parameter, you can specify terms.sort=count|index instead of true|false. Default is to sort by count.

          Show
          Matt Weber added a comment - Updated patch to resolve conflicts with the recent changes to trunk (rev. 773446). Also to keep the sort parameter similar to the facet.sort parameter, you can specify terms.sort=count|index instead of true|false. Default is to sort by count.
          Hide
          Matt Weber added a comment -

          I have implemented TermsComponent sorting by frequency. I use the same technique as facet sorting. Enable sorting by the parameter "terms.sort=true|false".

          Show
          Matt Weber added a comment - I have implemented TermsComponent sorting by frequency. I use the same technique as facet sorting. Enable sorting by the parameter "terms.sort=true|false".

            People

            • Assignee:
              Unassigned
              Reporter:
              Matt Weber
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development