The instructions on this page give a good overview of how to create a new search query, but I was wondering if I could get some instructions on how to create a new SearchSort.
http://confluence.atlassian.com/display/CONFDEV/Extending+the+V2+search+API
I created the sort but need come kind of mapper that implements the sort. My query works just fine when used with the PredefinedSearchBuilder, but when I try to add the sort to SearchQueryParameters, I get this in the logs:
"A lucene mapper could not be found to map the specified search"
Community moderators have prevented the ability to post new answers.
Ok I figured out what to do. Basically I just needed to write my own extractor that adds the fields un-tokenized to the index and then have my sort reference the un-tokenized fields. This is exactly what the page title does and now I can make Lucene do all the work of searching and sorting.
Basically "handles" maps your SearchSort the the appropriate mapper(I just used the case insensitive one) while sortfield allows you to specify a different field to actually sort on (the un-tokenized one in my case).
The discussion here helped:
Ok one more tidbit. I think part of the issue is the metadata is tokenized. Simple metadata (such as AAA, BBB, CCC, DDD, etc) seem to sort correctly but throwing spaces and special characters into the mix breaks the sort for those items.
According to this page:
http://confluence.atlassian.com/display/DOC/Confluence+Search+Fields
the page title is also tokenized, but it can be sorted anyway. How can I apply this to metadata?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok I was able to find LuceneSortMapper burried here:
http://confluence.atlassian.com/display/CONFDEV/Confluence+Plugin+Module+Types
and lucene-sort-mapper (which takes an additional "sortField" param) in a random svn commit that was picked up by google, but this doesn't seem to work for metadata (specifically scaffolding fields). Is it not possible to sort this way?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.