Hi Reto,

On 04/11/2012 10:10 AM, Reto Bachmann-Gmür wrote:
> Hi Suat
>
> Thanks for your reply.
>
> I've read that milton is having problems with their maven repository, I
> hope they'll manage to get things to central soon.
>
> I'm still a bit confused, trying to summarize:
> . A facet is something like "place", or "organization", is this just the
> same as "facet field name"?

FacetField of Solr represents the facet itself with all inner data e.g
name, values, etc. FacetResult of Contenthub is a wrapper for FacetField
including the type of facet since FacetField does not contain the
facet's type.

> - The current code is getting these with
> featuredSearch.search("*:*").getFacets() and for each of this
> getFacetField().getName() is invoked to get the name. Do facets or facet
> fields map to rdf properties?

By "rdf properties", if you mean the additional constraints (field:value
pairs) attached the to content item, yes they correspond to facets. For
example places, organizations are automatically generated constraints
using enhancements of a content item.

> - By "initialize constraints using facet results return in allResults
> object" you mean I create a map with the names of the facet fields of the
> facets as keys and an empty list as value?

Not empty list but list containing intended facet values to filter
results. For example, if you want to filter initial keyword search
results according to "places" facet and see the documents related with
"Turkey", the list corresponding to "places" facet should contain Turkey.

> - The facet field value is something like "Turkey" or "IKS", this is
> represented as an instance of Count with "Turkey" or "IKS" as its name
> - why do I get instances of DocumentResult which are similar to ContentItem
> but which are not related to it? Why do we need a URI as local id and one
> that is dereferenceable? Where does the title come from?

DocumentResults are initialized with the values directly obtained from
Solr and most of them e.g title, enhancement count, mime type are
intended to be shown in the HTML interface. I left their getter methods
in the interface as they can be counted as they would provide additional
information about a search result. Maybe it wasn't a wise decision. To
create an actual content item, we should fetch its content and
enhancements also.

Title can be set while storing a content item to Contenthub. If it is
not explicitly specified its id used. Local id is the actual id of a
content item and AFAIK the id should be a URI so that content item can
be processed by enhancer. And the dereferancable URI can be used to
access the actual content item through REST services of Contenthub.

> My impression is that things are quite complex and could be easier by
> better abstracting away the solr based implementation.
>
> I think we could expose an easy to use interface that's independent of
> vfolder or the webview and can thus easily be integrated in CMSs and other
> applications.
>
> I'll write a proposal on how such an API could look like.

I would be glad to see your proposal. I think we can adapt
FeaturedSearch stuff so that it would be easier to use and more useful.

Thanks,
Suat

> Cheers,
> Reto
>
>
>
> On Thu, Apr 5, 2012 at 6:18 PM, Suat Gonul <[email protected]> wrote:
>
>> Hi Reto,
>>
>> On 04/05/2012 04:54 PM, Reto Bachmann-Gmür wrote:
>>> Thanks Suat,
>>>
>>> With your help I could implement the support to go one level deeper.
>>>
>>> The corresponding webdav class is here:
>>>
>>>
>> http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/CountResource.java?view=log
>>> So one can now mount the webdavshare, go into the category (e.g. places)
>>> select an entry (e.g. Switzerland). I don't know how to get the next
>> level
>>> which should be
>>> - the matching content items
>>> - and again the categories as in the root folder but only for categories
>>> that contain entry that help reducing the matching set (to a proper but
>>> non-empty subset)
>>
>>  "SolrQueryUtil.prepareFacetedSolrQuery" method is used to construct a
>> SolrQuery. But, it requires additional parameters other than the
>> original query term.
>>
>> 1) allAvailableFacets: This can be obtained through:
>> featuredSearch.getAllFacetResults();
>>
>> 2) constraints: This is a map like Map<String, List<Object>>. You should
>> populate keys of this map with the facet names (i.e directory names).
>> Corresponding List<Object> should be filled with intended facet values
>> to filter results. This can be done during the traversal of facet
>> results obtained in the SearchResult object.
>>
>> So, the code looks like the one below. I hope it clarifies the usage.
>>
>> SearchResult allResults = featuredSearch.search("*:*");
>> Map<String, List<Object> constraints;
>> //initialize constraints using facet results return in allResults object
>>
>> SolrQuery query = SolrQueryUtil.prepareFacetedSolrQuery("*:*,
>> featuredSearch.getAllFacetResults(), constraints);
>> SearchResult filteredResults = featuredSearch.search(query);
>> //get the matching documents with provided constraints
>> List<DocumentResult> documents = filteredResults.getDocuments();
>>
>>
>>
>>> I think webdav access should be identical to the web access to faceted
>>> search with the exception that one can only remove filters in the inverse
>>> order of adding them. The idea is to have a simple demo of the webdav
>>> capabilities so that more virtual folders can be added providing a user
>>> friendly way to access stanbol.
>> AFAIU, directories correspond with the facet names e.g places as you
>> mentioned earlier. So, when one goes into the places folder, he will see
>> the documents having an associated places field. Also, he will see other
>> folders corresponding to values regarding with places facet. If so, I
>> also think this is a nice alternative to navigate on documents.
>>
>>> Another issue is that one can start featuredSearch only with a full-text
>>> query, for webdav one should be browsing the whole set of content items,
>>> but I think searching for "a*" is good enough to get started.
>> *:* seems to work. Could you please try this one?
>>
>>> To install the current version you need to check out and install on your
>>> stanbol instance:
>>> -
>>>
>> http://svn.apache.org/repos/asf/incubator/stanbol/branches/ontonet-showcase/webdav/
>>> -
>>>
>> http://svn.apache.org/repos/asf/incubator/stanbol/branches/ontonet-showcase/featured-vfolders/
>>
>> I couldn't compile branches as there is a problem when downloading
>> milton related dependencies.
>>
>>
>>> After that you can mount http://localhost:8080/vfolders/ with webdav.
>>>
>>> Would be great if you could help me getting one level deeper. As it is
>> only
>>> a subset of the functionality accessible with the webbrowser I hope this
>>> code can be accessed, and that this can abstract away the assembling of
>>> query string. For now I see now need for range-queries with the webdav
>>> access.
>> See above code snippet.
>>
>> Best,
>> Suat
>>
>>> Cheers,
>>> Reto
>>>
>>>
>>> On Thu, Apr 5, 2012 at 2:17 PM, Suat Gonul <[email protected]> wrote:
>>>
>>>> Hi Reto,
>>>>
>>>> You can use the featured search by constructing a SolrQuery using the
>>>> facet names and values as in the following example:
>>>>
>>>> SolrQuery query = new SolrQuery();
>>>> query.setQuery("a*");
>>>> query.addFilterQuery(<facetName> + ":"+
>>>> ClientUtils.escapeQueryChars(<facetValue>));
>>>> featuredSearch.search(query);
>>>>
>>>>
>>>> You can obtain facet values by:
>>>>
>>>> for (Count count : facetResult.getFacetField().getValues()) {
>>>>  String facetValue = count.getName();
>>>>  long documentCount = count.getCount();
>>>> }
>>>>
>>>>
>>>> Based on the types of results facets e.g int, double, date, etc. you can
>>>> write range queries. Type of a facet can be obtained by:
>>>>
>>>> facetResult.getType();
>>>>
>>>>
>>>> You can have a look at solr query syntax for range queries at [1].
>>>>
>>>> Best,
>>>> Suat
>>>>
>>>> [1] http://wiki.apache.org/solr/SolrQuerySyntax
>>>>
>>>>
>>>> On 04/05/2012 01:14 PM, Reto Bachmann-Gmür wrote:
>>>>> Hello
>>>>>
>>>>> I'm trying to programmatically access the facetted browsing features. I
>>>> got
>>>>> the first step, getting the top level categories with:
>>>>>
>>>>>             SearchResult searchResult = featuredSearch.search("a*");
>>>>>             List<FacetResult> facetResults = searchResult.getFacets();
>>>>>             for (FacetResult fr : facetResults) {
>>>>>                 final String name = fr.getFacetField().getName();
>>>>>                 System.out.println("name: "+name);
>>>>> }
>>>>>
>>>>> How do I get the faceted search entries in the enumerated categories,
>> and
>>>>> how do I apply such an entry, how do I get the matching content items?
>>>>>
>>>>> Cheers,
>>>>> Reto
>>>>>
>>

Reply via email to