-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BoboBrowser.Browse method exception #5
Comments
As I mentioned previously, the values that are specified for selections in a RangeFacetHandler must correspond to the range strings that are specified when creating the handler. // Specify range handler
categoryFacetHandler = new RangeFacetHandler(category, new List<string> { "[Articoli TO Clienti]", "[Clienti TO *]" });
// Specify selections
sel1.AddValue("[Articoli TO Clienti]"); Corrected version of CategoryFacetNavigation: private static int CategoryFacetNavigation(Type facetHandlerType)
{
// Definizione facce.
string category = "Category";
IFacetHandler categoryFacetHandler;
if (facetHandlerType == typeof(SimpleFacetHandler))
{
categoryFacetHandler = new SimpleFacetHandler(category);
}
else if (facetHandlerType == typeof(MultiValueFacetHandler))
{
categoryFacetHandler = new MultiValueFacetHandler(category);
}
else if (facetHandlerType == typeof(RangeFacetHandler))
{
categoryFacetHandler = new RangeFacetHandler(category, new List<string> { "[Articoli TO Clienti]", "[Clienti TO *]" });
}
else
{
throw new InvalidOperationException("Unknown facet.");
}
ICollection<IFacetHandler> handlerList = new IFacetHandler[] { categoryFacetHandler };
string indexDir = @"../../../data/index";
using (Lucene.Net.Store.Directory idx = FSDirectory.Open(new System.IO.DirectoryInfo(indexDir)))
{
using (IndexReader reader = IndexReader.Open(idx, true))
{
using (BoboIndexReader boboReader = BoboIndexReader.GetInstance(reader, handlerList))
{
// Request.
BrowseRequest browseRequest = new BrowseRequest();
browseRequest.Count = 10;
browseRequest.Offset = 0;
BrowseSelection sel1 = new BrowseSelection(category);
if (facetHandlerType == typeof(RangeFacetHandler))
{
sel1.AddValue("[Articoli TO Clienti]");
}
else
{
sel1.AddValue("Articoli");
sel1.AddValue("Clienti");
sel1.AddNotValue("Ordini");
sel1.SelectionOperation = BrowseSelection.ValueOperation.ValueOperationOr;
}
browseRequest.AddSelection(sel1);
// Query.
MatchAllDocsQuery query = new MatchAllDocsQuery();
// Add the facet output specs.
FacetSpec spec1 = new FacetSpec();
spec1.OrderBy = FacetSpec.FacetSortSpec.OrderValueAsc;
spec1.MaxCount = 20;
browseRequest.SetFacetSpec(category, spec1);
// Browse.
IBrowsable browser = new BoboBrowser(boboReader);
BrowseResult result = browser.Browse(browseRequest);
// Result.
return result.NumHits;
}
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Executing this test, I get back the following error from
BoboBrowser.Browse
method:This exception pops out only when
RangeFacetHandler
is used.The text was updated successfully, but these errors were encountered: