CSControl:IndexPostList - QuerryOverrides Issues with Tag attributes

CSControl:IndexPostList - QuerryOverrides Issues with Tag attributes

This question is not answered

For the control: <CSControl:IndexPostList…>

When using the Tags attribute in <QuerryOverrides ID=”InterestQueryOverrides” Tags=”…>

Current behavior: when using the Tags attribute in the QuerryOverrides, the string that is being passed to the control seems to do an exact match for the complete string. As a result, it never finds a match.

The expected behavior is to receive a list of all PostData items in that list that match one or more of those keywords.

For example: if the keywords passed are: “cupcakes,sports,cats”: Currently, it tries to find PostData items that match “cupcakes” AND “sports” AND “cats” in their keywords. We expect to receive PostData items that match “cupcakes” OR “sports” OR “cats”. The list of PostData items that is received should not include repeated items.

The issue is not that it can take MULTIPLE tags, the issue is that they take the MULTIPLE Tags and consider them as a SINGLE STRING or they USE each tag with an AND operator (where it actually should be an OR operator).

We were told to "They need to add the following attribute to the QueryOverrides for the IndexPostList:  LogicallyOrTags="true" " however this did not work.

We have tried in the past to change this and it is not returning the proper values either. Regardless of what we use under the LogicallyOrTags attribute (true or false) it still returns an empty list.   The only time this seems to work is when we submit 1 tag (a single tag) to the QueryOverrides. Whenever we submit a string of multiple tags separated by a ",", the control tries to match ALL of the tags at the same time, returning no matches.

We are currently receiving the list of tags using the following:
Interests.Retrieve(CSContext.Current.User.Username)

We usually trim any empty spaces and the final "," to make it work. (We tried using it as is and it didn't work either).

At this point, we need to make sure that the control works using an "OR" as opposed to an "AND" operator properly.  If not, we need to know HOW to programmatically create a list of PostData items filtered by a each key word individually (documentation and usage needs to be provided).

Can anyone help?

 

I need documentation on how exactly that Control is constructed so that I can access those PostData items inside of the IndexPostList. Does the queryoverride return what? A new list? What are the contents of that List?

All Replies
  • Hi Dankin,

    The correct way to OR tags in your query rather than the default AND behaviour is to see the LogicallyOrTags property of the QueryOverrides to "true".  

    From the documentation:

    LogicallyOrTags Boolean Gets or sets a value indicating whether to logically 'or' tags, otherwise tags are 'and'-ed.

    For further trouble-shooting, is your site configured to use the search barrel search, or enterprise search? 

    Best regards,

    -Xander

  • Hi Xander.  Unfortunately, this is the same information that Yusuf suggested to us last week. that does not work.

    The “LogicallyOrTags” attribute is set to “true” and it still does not return this value.  The issue is still the same: it always performs an AND regardless of what the “LogicallyOrTags” attribute is set to.  The control works fine whenever the passed string contains a SINGLE keyword.  Otherwise, it does not return any values (since it tries to match all of them).

    So the moment you try and solve for multiple matches, the logic doesn't work.

  • Hi Dan,

    Is your site configured to use the search barrel search, or enterprise search?   And are you using the same search provider setup in both dev and production?  

    Best regards,

    -Xander

  • Hi Dan,

    I've had a look at your code, and I think I've tracked down the issue to the custom search provider that your site uses, rather than the IndexPostList.   

    In \Dev\Slingshot.Search\Manager.cs lines 993-999 look like this: 

    BooleanQuery tagsQuery = new BooleanQuery();
    foreach (string tag in search.Tags)
    {
        Term t = new Term(Constants.Fields.TagKeyword, tag.ToLower());
         tagsQuery.Add(new TermQuery(t), BooleanClause.Occur.MUST);
     }
     bq.Add(tagsQuery, BooleanClause.Occur.MUST);

    What you could do would be to change that to the following to re-enable the LogicallyOrTags option.

    BooleanQuery tagsQuery = new BooleanQuery();
    foreach (string tag in search.Tags)
    {
        Term t = new Term(Constants.Fields.TagKeyword, tag.ToLower());
        if (!search.LogicallyOrTags)
            tagsQuery.Add(new TermQuery(t), BooleanClause.Occur.MUST);
        else
            tagsQuery.Add(new TermQuery(t), BooleanClause.Occur.SHOULD);
    }
    bq.Add(tagsQuery, BooleanClause.Occur.MUST);

    Hopefully this will resolve the issue.   I would advise that this be thoroughly tested, even it it resolves this issue to make sure that it doesn't cause issues anywhere else the site relies on search.

    Best regards,

    -Xander