locked
TFS 2012 - work item search - customize query template

    Question

  • Hello,

    When I enter some text into Search work items entry TFS 2012 builds ad-hoc query to display results of my search. To make this feature really usable I have one question:

    How to change list of the fields that are searched (by default title and description). I would like to include fields from my customized templates or just fields like History or Repro Steps.

    Maybe I could change the query template that is used by TFS? how to do this?

    Best Regards,

    Pawel

    Wednesday, September 12, 2012 3:53 PM

Answers

  • Hi Pawel,
     
    For TFS 2012, you can refer to this article http://msdn.microsoft.com/en-us/library/cc668120.aspx, Especially Specify fields and field values part. It shows how to find work items based on a keyword or phrase contained within other text string fields.
     
    I hope this information will help resolve this issue.
     
    If anything is unclear, please free feel to let me know.
     
    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, September 13, 2012 9:45 AM
    Moderator

All replies

  • Hi Pawel,

    Thank you for your post.

    Seems you want to add your custom work item field as search field when use Search Work Items. If I have misunderstood anything, please free feel to let me know.

    For TFS 2012, you can refer to this artilce http://msdn.microsoft.com/en-us/library/cc668120.aspx

    As far as i know, for TFS 2010, if you want to modify which work item fields are searchable, type in "--template" (no quotes) into the search box and hit enter. This will open the search template. Just add another "Or" statement, pick the field name, select an operator, type "[search]" (no quotes) in the value field, and hit ctrl + s to save. The next time you run a search it will use the modified search template.

    I hope this information will help resolve this issue.

    If anything is unclear, please free feel to let me know.

    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, September 13, 2012 2:54 AM
    Moderator
  • Lily,

    Thank you for the answer. You exactly understood what I want to achieve but I cannot make your solution working.

    Using "--template" secret key works perfectly in "Search Work Items for TFS 2010" Visual Studio Extension but it does not make a trick in TFS 2012 (neither of both Web and Visual Studio's 2012 team explorer). In TFS 2012 is just presents search results for "template" word.

    Am I doing something work? I hope we are close to the success here.

    Best Regards,

    Pawel

    Thursday, September 13, 2012 6:49 AM
  • Hi Pawel,
     
    For TFS 2012, you can refer to this article http://msdn.microsoft.com/en-us/library/cc668120.aspx, Especially Specify fields and field values part. It shows how to find work items based on a keyword or phrase contained within other text string fields.
     
    I hope this information will help resolve this issue.
     
    If anything is unclear, please free feel to let me know.
     
    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, September 13, 2012 9:45 AM
    Moderator
  • Lily,
    Thank you for the reference - it was really useful to discover advanced features of the TFS 2012 work item search box.
    The issue is that in 99% of cases users will enter basic search term (like in google/bing) and I would like to extend default behaviour do search not only Title+Description but also additional field (standard or custom).

    Can I do this as TFS 2012 admin?

    Best Regards,
    Pawel

    Thursday, September 13, 2012 12:30 PM
  • HI Pawel,

    As the article mentioned, to use work item search syntax, you must be a member of the Contributors group or have the Edit work items in this node permission set to Allow. So i think TFS admin also can do this.

    Except search keywords or phrases in the Description, Repro Steps, or Title fields, you also can find work items based on a keyword or phrase contained within other text string fields. In this situation, you need to care about the syntax type in search box, it is more complex than enter keywords.

    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, September 14, 2012 1:57 AM
    Moderator
  • Hi Pawel,

    How about the issue now?  I suggest you mark useful post as answer, it will be very beneficial for other community members having the similar questions.

    If anything is unclear, please free feel to let me know.

    Best Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, September 17, 2012 7:58 AM
    Moderator
  • i have both VS 2008 and 2010 installed. Now when i type "--template" from VS 2010, it opens an instance of VS 2010. So i cannot see the search template. Why is it opening 2008 instance and how to fix it ?

    FJ

    Thursday, September 27, 2012 11:07 AM
  • Hi Pawel, I am also looking for a solution to this problem. 

    We want the search field to search  custom text fields without the use of a custom search syntax, by just entering the keyword.

    I drilled throught the javascript a bit until the point where the search control differentiates the input between keyword and workitem id. From there on it gets more difficult to track whats happening under the hood and i couldnt figure out where the standard search template is applied yet.  I guess there is no way to change the standard search template from the frontend.

    I'd be happy for some input as well.

    Cheers,

    Dave

    Thursday, October 4, 2012 8:29 AM
  • Hello,

    I believe that the current conclusion for the thread is following:

    Let’s say I enter following into “search work item” field: searchword

    It seems that in TFS 2012 there is hardcoded logic that searches fields like Title or Description for such simple strings (you can observe this by looking into the query behind the search).

    By entering values that are especially formatted (“my field”:searchword) you can also force TFS to search in other fields. This is described here: http://msdn.microsoft.com/en-us/library/cc668120.aspx .
    This is nice - but 99% of users will not find this usable as they do not use similar “advanced search” in google nor bing and still find what they want - which is not the case here. I do not want to discuss complexity of searching multiple fields for multiple words as this is just nightmare.

    It seems that we do not know the way to configure TFS to include additional fields in simple search. In my opinion this is quite unfortunate limitation and I would suggest adding ability for such configuration to the backlog of (near) future enhancements.

    But if anybody knows or finds the solution to do it now – please let us know here.

    Best Regards,
    Pawel

    Monday, October 8, 2012 10:07 AM
  • Hi Pawel,

    I agree with you. TFS hard coded to search title or description fired for work item search by default.

    For search other field, it is difficult for us the use. I plan to put a feedback to http://visualstudio.uservoice.com/forums/121579-visual-studio

    Tuesday, October 9, 2012 5:59 AM