This project is read-only.

Search facet web part: Multiple values in single column

May 7, 2008 at 9:23 PM
I added additional column ('keywords') to display in Search Facets web part.
And it displays fine. However certain objects have more than one keyword associated with them. So , for example, Out-of-office eform has the following values in Keywords field: 'sick;leave;vacation'.
They are displayed like this (in one line) on results page. Is there any way to have separate entries under Keywords, one under another: sick, leave, vacation? So users will be able to click on on one keyword instead of clicking on all keywords at the same time.
Thank you
Jun 3, 2008 at 1:29 AM
Edited Jul 1, 2008 at 9:52 PM
I have the same question. Did you figure this out?

Thanks,
Vaegy
Jun 3, 2008 at 4:52 AM
Edited Jun 3, 2008 at 4:56 AM
You might experiment w/ RegEx in constants.cs

Vaegy wrote:
I have the same question. Did you figure this out?

Thanks,
Vani


Jun 3, 2008 at 8:14 PM
Could you please elaborate on
You might experiment w/ RegEx in constants.cs

What exactly should I do? What is RegEx?
Jun 3, 2008 at 10:31 PM
Here is what I understood/found:

Regex is used to match patterns in strings - comes from "Regular Expressions" (found a tutorial here: http://www.regular-expressions.info/tutorial.html).

If you download the source code and look at Constants.cs, you'll find a constant string called "REGEX_LOOKUP_SPLITTER", which is a regular expression. It appears that this string is used later in SearchFacets.cs to create a Regex object, which is then used to split multiple facets in a single row into individual facets (I did a search for Regex in the source code). I guess, the suggestion is to experiment with regular expressions so that the code will correctly split multi-valued columns into individual facets.
  1. Please confirm that the information above is correct. Any additional information or suggestions will be appreciated.
  2. I am not very familiar with regular expressions - if the current code already handles multiple values in a column, is there something we can do to make it work - like use a different separating character between keywords?

Thanks,
Vaegy

 

Jun 4, 2008 at 5:53 PM
Edited Jun 4, 2008 at 6:08 PM
While experimenting with the regular expression (?:;#)?\d+;# in the Constants.cs file, we found that if we use ;# (preceeded by one of more digits), e.g. 1;# or 1111;# as a delimiter for keywords, then the keywords are separated into their individual values in the facet webpart. E.g. Suppose you create a document, called MyDocument, in SharePoint and add a column to it with the following string in the keywords column: "KeywordA1;#KeywordB1;#KeywordC1;#," then if you search for MyDocument (and of course include a column for keywords in the XSLT) then it shows 3 facets - KeywordA, KeywordB and KeywordC. So it correctly splits them into individual facets. However, if you search for KeywordA, the search does not return MyDocument - so this doesn't seem to be tied in with search yet.

Commas work with regular search - so if you had KeywordA, KeywordB, KeywordC in the keywords column for MyDocument and if you search for KeywordA, search would return MyDocument. Maybe using commas for delimiters in the regular expression above, would work.

Thanks,
Vaegy
Jun 19, 2008 at 6:52 PM
I managed to make the keywords facet work with core search results by changing the regular expression to split using commas. Please let me know if you would like more details.

Thanks,
Vaegy
Jul 1, 2008 at 4:51 PM
Hello,

I'm having the same problem and I would really like more details on how you managed to split the string in the column you used.

I also have another problem :
I created a managed property based on a custom site column (crawled property mapping) in order to use it as a facet in the facet search. I then performed a full crawl of my content source so that the new property would be usable as a facet.
Now when I type a search query that matches content, the facet search does not display the right number of hits (even the right number of results are shown in the search results) and when I click on a facet I get the "No results" message while the search facets webpart still displays a number of hits (a wrong one but anyway).

Any help would be much appreciated, I'm starting to lose my mind on this ;-)

Thanks
K.  
Jul 1, 2008 at 9:42 PM
Hi KhAlAiD,

I changed the value of the string REGEX_LOOKUP_SPLITTER in the Constants.cs file to be (?:,) instead of the original (?:;#)?\d+;#

That's it as far as modifying the code is concerned. I then just recreated the solution and redeployed it. At first, I couldn't figure out how to redeploy it (see my post: http://www.codeplex.com/FacetedSearch/Thread/View.aspx?ThreadId=29132), but with some help and poking around I could do it. I don't want to assume that you need more information on that process - let me know if you do.

I then created two document libraries in SharePoint. Added a "keywords" column to each of them. Created a couple of documents in each library with comma separated keywords for each document in the keywords column. Then, when I crawled the content, that column showed up as a crawled property. I then mapped it to a managed property called Keywords, included Keywords as a facet in the XSLT for the facet webpart. This seemed to work and give expected results.

Earlier, I had also created a facet corresponding to the "File Extension" managed property. That seems to work as well. Have you tried that and does that work for you? I know there are some issues with the number of items that the facets webpart shows versus the number of items the core search results webpart shows - so that may be the problem too. See:(http://www.codeplex.com/FacetedSearch/Thread/View.aspx?ThreadId=17396 and http://www.codeplex.com/FacetedSearch/WorkItem/View.aspx?WorkItemId=3909). Hope this helps.

Thanks,
Vaegy

KhAlAiD wrote:
Hello,

I'm having the same problem and I would really like more details on how you managed to split the string in the column you used.

I also have another problem :
I created a managed property based on a custom site column (crawled property mapping) in order to use it as a facet in the facet search. I then performed a full crawl of my content source so that the new property would be usable as a facet.
Now when I type a search query that matches content, the facet search does not display the right number of hits (even the right number of results are shown in the search results) and when I click on a facet I get the "No results" message while the search facets webpart still displays a number of hits (a wrong one but anyway).

Any help would be much appreciated, I'm starting to lose my mind on this ;-)

Thanks
K.  



Mar 2, 2010 at 10:50 AM

Hello,

I'm just starting to work with MOSS 2007 but it looks like I'm facind an issue similar to yours. I want to use the CodePlex Faceted search component but my very basic problem is : how can I create a text column that will be considered by sharepoint as multi-valued so all the different contents will be indexed separately ? Multi-choices, list-box, etc ...are not options for me since I would like this column to be populated in batch mode. The use case is this one :

I have a product than can automatically extract person names, companies, locations, protein and genes, etc .... I would like the documents to be processed by my component and then populated back with all the information I've found. As a result, a document would contain a column named "companies" and containing all the companies mentionned in the document. As you can see, all the predefined multi-valued columns won't fly since I cannot now in advance their contents.

To me it seems a very basic features but I have been struggling quite a long time on this issue and I'm loosing faith.

I've trie the last post from Vaegy but this does not work for me. The column is not recognized as multi-valued by Sharepoint so won't be indexed as such.

Any help or workaround would be greatly appreciated.

Hervé