Creating a Custom Advanced Search Box in MOSS 2007
The Search Results Core web part is quite easy to customise with XSL, which makes it a good out of the box solution for displaying data that comes from multiple sites or even multiple farms.
Unfortunately specifying the query to use is not quite so easy, limiting you to a hardcoded query with the fixed keyword query properties or whatever the user can type in to the standard search box. Sometimes this is enough, but the keyword syntax is too limited if you want to do something like return results newer than a certain date. For that you need to be using the SQL search syntax.
The advanced search web part uses SQL syntax and can get just about any result set you want. However, the UI is not really simple enough for the average user and isn’t that convenient for searching lookup fields. Time to try customising the advanced search interface.
My first thought was to override the Advanced Search webpart. However, I on looking through the code in reflector I noticed that the advanced search webpart doesn’t contain any code to build the query. That happens in a control called SearchResultHiddenObject, which is marked internal so there is no way to modify the construction of queries in code. On the other hand, the fact that the Advanced Search webpart doesn’t do any special processing means that it can be safely removed.
Copying the html source for the webpart into a content editor webpart works quite well, or at least it did once I removed some of the table structure – “?Contents=1″ is a very useful query string if your html breaks the menus. Note that you probably shouldn’t edit the html directly in the cewp source editor, as it is difficult to get at the editor again if it is wrong, and you probably don’t want to delete all your code, which is the only option the recovery interface gives you.
As well as the web part itself, you need to copy some script and hidden fields – the script block starts with the function DisplayNextProp and the hidden fields are ASB_TextDTProps, ASB_DateTimeDT_Props and ASB_ResType_Query.
Next step is to make a cut down version, getting rid of the table structure, giving me a relatively easy to modify form with all the original fields. The javascript can also be safely removed as it is only for updating the UI, and the whole point of the customisation is to replace that UI. I’m not sure what ResetPageHashCode does, but removing it doesn’t seem to have any effect.
What we are left with is a set of html controls that can be modified as needed. There is no need to register the controls anywhere and the first part of the name is ignored – the SRHO just checks the part of the name starting with “ASB”. All of the fields are optional, and the SRHO will ignore any missing values. The numbering of the controls with multiple instances such as the property controls has no special requirements – as long as they match the pattern ASB_PS_ they will work.
ASB_TextDT_Props and ASB_DateTimeDT_Props Are lists separated by “#;#” which specify the properties which will be treated as text and datetimes respectively when building the query. All others are treated as numbers.
ASB_ResType_Query is set by the result type dropdown and can be used to include some raw SQL. However, the SRHO requires at least one other piece of the query to be used.
ASB_PS_lolb_0 is the operator to use between properties – either “And” or “Or”. This is required if multiple properties are checked and the same operator is used for all properties.
ASB_TQS_AndQ_tb is the “All of these words” search box.
ASB_TQS_PhraseQ_tb is for an exact phrase.
ASB_TQS_OrQ_tb is for “Any of these words”.
ASB_TQS_NotQ_tb is for words to exclude. It can only be used if another search term is also specified.
The language checkboxes are named in the format ASB_SS_lcb_0_12 with a value of “on”. The first number is a zero based index, while the last number corresponds to langdef values in the properties of a default search box. I’m not sure where those values come from.
Search Scope checkboxes are similar, with the format ASB_SS_scb_0_16 but no value set. The last number is the scope ID, which you can find in shared service administration.
Finally there are the property selectors. You can have as many of these as you want – just change the number at the end.
ASB_PS_plb_1 is the internal name of the property to search
ASB_PS_olb_1 is the operator, which will be one of the following values:
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorContain)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorNotContain)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorEqual)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorNotEqual)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorLater)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorGreater)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorEarlier)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorLess)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorTrue)
- WebPartPlatform.Current.GetLocResourceString(LocStringId.AdvancedSearch_OperatorFalse)
or in English:
- Contains
- Does not contain
- Equals
- Does not equal
- Later than
- Greater than
- Earlier than
- Less than
- Is true
- Is false
ASB_PS_pvtb_1 is the value to search for.
Putting this all together, we get the following code which when placed in a content editor webpart will provide a dropdown to choose from a list of known authors and display the results in a search core results web part on the same page (assuming the url in the submit button is set to the current page).
<input type="hidden" name="ASB_TextDT_Props" id="Hidden4" value="Title#;#Author#;#Region" />
<input type="hidden" name="ASB_DateTimeDT_Props" id="Hidden5" value="Write#;#Created" />
<input type="hidden" name="ASB_DateTimeDT_Props" id="Hidden5" value="Write#;#Created" />
Author:
<input name="nameprefix$ASB_PS_plb_1" type="hidden" value="Author" />
<input name="nameprefix$ASB_PS_olb_1" type="hidden" value="Contains" />
<SELECT name="nameprefix$ASB_PS_pvtb_1">
<OPTION></OPTION>
<OPTION>Carolyn</OPTION>
<OPTION>Clinton</OPTION>
<OPTION>Tom</OPTION>
</SELECT>
<input name="nameprefix$ASB_PS_lolb_0" type="hidden" value="And" />
<input name="nameprefix$ASB_PS_plb_1" type="hidden" value="Author" />
<input name="nameprefix$ASB_PS_olb_1" type="hidden" value="Contains" />
<SELECT name="nameprefix$ASB_PS_pvtb_1">
<OPTION></OPTION>
<OPTION>Carolyn</OPTION>
<OPTION>Clinton</OPTION>
<OPTION>Tom</OPTION>
</SELECT>
<input name="nameprefix$ASB_PS_lolb_0" type="hidden" value="And" />
<INPUT id="Submit1" onclick='WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("nameprefix$ASB_BS_SRCH_1", "", false, "", "/sites/home/SearchTest/default.aspx", false, false))' type="submit" name="nameprefix$ASB_BS_SRCH_1" value="Search" />
Advertisement
You, my friend are a saviour! This looks like a life-saver!
dattard
November 9, 2007 at 9:02 am
Excellent, thanks for blogging this.
nickpearce
November 16, 2007 at 4:52 pm
excellent blog. one question, how does one go about capturing the html for the web part?
jason
November 20, 2007 at 1:38 pm
All the important stuff is client side, so you can use the browser’s view source feature to get everything you need. If finding the relevant html in notepad seems like too much trouble, the IE Developer Toolbar works quite well for capturing the html source of a single web part.
Tom Clarkson
November 22, 2007 at 1:10 am
Hi Tom,
I’m trying to put a custom advanced search web part since I have many look up fields and some other actions that I need to do on the my search web part. However I would like to use the SearchCoreresults web part to display my results. Not sure if i could still use it..Appreciate your help. Thanks..
Vee
November 27, 2007 at 12:06 pm
This approach gives you a custom web part with exactly the same output as the standard advanced search box web part. The standard results web part will work with it, as will the various other web parts on the search center results page.
Tom Clarkson
November 30, 2007 at 10:28 pm
This is veruy helpfull,but i am having trouble adding two dropdown menus. A sample with a number of search options would be great
john
December 11, 2007 at 4:58 am
>> That happens in a control called SearchResultHiddenObject, which is marked internal so there is no way to modify the construction of queries in code. <<
That's not fully true… it is possible with reflection. I did it successfully to implement wildcard searching with MOSS. I know, reflection is evil, but – so what?
Stefan
December 12, 2007 at 1:04 am
Very nice!
Thank’s for sharing
Itay Shakury
December 25, 2007 at 4:03 am
This is great!
Is it possible to specify the property to sort by for the result or how is that best done when showing the result in the Core Results Web Part?
Pär Wallin
January 16, 2008 at 5:46 am
John: check out the examples on dattard’s blog (link above)
Stefan: Good point. Sharepoint does have a way of making us use evil coding techniques.
Par: You might be able to do something with ASB_ResType_Query. Sorting in the results web part is probably easier, though some forms of sorting there only apply to a single page.
Tom Clarkson
February 9, 2008 at 10:12 pm
I got everything setup and it works perfect. Any idea how to get the search results to work with the paging web part? It seems to render the correct number of links for the paging webpart, but clicking on any of them does work.
-John
John Ross
February 23, 2008 at 7:57 pm
I haven’t noticed any issues with the paging, though the implementation I have been using more recently is slightly different.
Could the issue be something to do with the keywords not persisting when you link to the next page? If that turns out to be the problem, you can use ASP.NET controls which automatically save their state rather than html fields.
Tom Clarkson
February 24, 2008 at 4:34 am
Strangely, I dropped the CEWP on the out of the box search page and the paging worked just fine. I have also customized my search core results web part to render differently and I wonder if that could be the problem?
John Ross
February 24, 2008 at 11:32 am
The problem with paging seems to occur when I try to have two search boxes on the same page. I was trying to have one search setup for one property and the other a different one. Because of the data, this method made the most sense. I’ll just have to see if I can come up with a creative way around this.
John Ross
February 24, 2008 at 12:16 pm
Using two web parts likely means that you have more than one control with the same name, which can lead to unpredictable results when the form is submitted – since they are on the same form you will either get the two values stuck together or it will just use the first one it finds.
The advanced search customised in this way is quite flexible – you can certainly set it up to search multiple properties. Any search boxes left blank will be ignored, and you can set ASB_PS_lolb_0 to search for either rather than both of the properties.
Tom Clarkson
February 24, 2008 at 5:52 pm
I’ve been testing this out all weekend, and paging never works for me — even with a single CEWP. If you add the paging web part to the page, it will initially show the correct number of results, but if you click to page 2 it loses state completely.
John Ross
February 26, 2008 at 8:26 am
Sounds like you need to try using ASP.NET controls – you have to switch from a cewp to a custom webpart or smartpart, but it gets you saved state.
Tom Clarkson
February 26, 2008 at 3:24 pm
I created a new custom advance search page and added the CEWP with the HTML you provided. I modified the value of the URL to go to my results page and am getting the following error when clicking on search:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Any thoughts on this? I assume that none of you are doing this in a farm scenario maybe?
Paul Davis
February 28, 2008 at 3:58 pm
I’ve got this working (limiting to a specific scope too). I would like to direct the results to a page in the SearchCenter. Whenever I try to use that URL in the postback function, I get an error.
What’s happening here? On submitting the search form, is there a way to GET the values into the URL of the searchCenter page?
Carl
March 20, 2008 at 7:44 pm
You might want to try a custom result page first – that way you can add the search center web parts one at a time and see where the conflict is.
Tom Clarkson
March 21, 2008 at 12:24 am
Thanks for the great example. Has anyone tried to get this to work while linking to a different page? Meaning put this sample code on one page and change the URL in the submit button to a different site that has the core results webpart on it.
I have tried this but get the “An unexpected error has occurred” screen.
Side Note – If i add the advanced search box webpart to the page, it works as expected. Missing some variables/resources? Any help would be great, thx
Jexter
March 25, 2008 at 3:39 pm
Can this be used to search for more than one property using just one input box? I need to allow users to enter a value in just one text box and then search across many properties for this value.
Caroline
March 31, 2008 at 10:28 pm
If you want to search any property, the keyword part of the search box will work. If you need to search just a specific set of properties, you will need multiple fields, but you can use hidden fields for most of them updated with javascript so that the user only sees the one field.
Tom Clarkson
March 31, 2008 at 11:35 pm
How would you search for a Yes/No field? How do you add them to the list of properties to search for?
Inquisitor
April 16, 2008 at 11:08 am
How do we search on two columns using two different text boxes in custom advance search and having AND in between. Let’s say i wanna do a search on Columns C1 and C2 and user have two text box T1 AND T2 once the user enters the value and hits the search it should return only those items in the list which has both the values in the respective columns. Please provide the javascript or some hint!! appreciate your help
celerity
April 24, 2008 at 6:02 am
Just duplicate the author bit from the example, changing the names in the copy to end with 2 instead of 1 and using textboxes instead of the select control as appropriate.
Tom Clarkson
April 24, 2008 at 9:54 pm
Hi Tom..Great post. However when i try to use a custom Search Results page i get this error – ”
This Page has been modified since you opened it. You must open the page again.
Refresh page.
Troubleshoot issues with Windows SharePoint Services.
“.
Can you please help!
RJ
April 28, 2008 at 7:43 pm
wonderful blog…
Any idea how can we customise search center with tabs webpart
Madhur Chadha
May 5, 2008 at 11:22 pm
Great blog Tom, I would like to ask if it is possible to direct the custom advanced search back to the default Search Centre results page instead of a custom results page?
I am receiving the following error when attempting to do so:
“This Page has been modified since you opened it. You must open the page again.
Refresh Page.
Troubleshoot issues with Windows SharePoint Services.”
Any advice or ideas would be greatly appreciated.
DC
May 6, 2008 at 7:03 pm
Hi,
I’m badly trying to run this on MOSS 2007 and I get this error:
Validation of viewstate MAC failed.
Please help me!! I’ve already lost too much time on this one!
Thanks a lot!
Jonthemoon
May 27, 2008 at 8:46 am
Hi,
I’m trying to get this to work on a site. It works on one that uses SearchCenter and doesn’t on one without the searchcenter. Is it possible that it needs SearchCenter to work?
JTM
May 27, 2008 at 1:34 pm
Hi,
The blog is wonderful,but i am facing one very strange problem in this.I have created one sitecolumn and corresponding managed property.After running the full crawl i am able to see the page with this column in results when i do basic search.Within advanced search i have created a filter on this column.Within the advanced search results i am able to see the page after applying filter,but only n some specific cases.The page doesn’t comes in following conditions:
If the sitecolumn contains string with number of characters greater than 67 and within the filter if i put any words which lies in first 67 characters,search results comes perfectly.But if the searched word does not lies in first 67 characters,results don’t appear.
But the results always comes in basic search.
Don’t know if it is the restriction of sharepoint that it is matching only first 67 characters or something is wrong with advanced search.
Any pointers on solving this?????
Amit
May 28, 2008 at 10:27 pm
Hi, This is awesome, it saved my lot of pains.
The only thing I am looking forward is how to get “scope Id” or how can I limit my search to specific library or list using above solution.
Your suggestions will be really helpful for me.
Thanks & Regards
Manish
Manish
May 29, 2008 at 5:18 am
Hi,
I’m too trying to get the scope ID list by code. If someone find it please post!
For the “viewstate error” I found that setting the viewstate field to “” works perfect on my site.
JTM
May 31, 2008 at 1:41 pm
@RJ, DC, Jonthemoon – Page and viewstate validation errors are probably a side effect of faking the asp.net output in html – the server doesn’t know about the input controls so validation may fail. This is one reason why shortly after writing this post I switched to using a serverside implementation that creates asp.net controls.
@Madhur Chadha – This is based on some of the search center web parts. For more extensive customisation of search center it’s usually best to build a custom page using as many of the search center web parts as you need.
@JTM – I’m not sure if you need an actual instance of Search Center, but you do need some of the web parts that are used by the out of box search center.
@Amit – 67 is an unusual number to trigger an error. It’s not likely to be related to the search customisations in this post. Try searching using all out of box components first.
@Manish, JTM – Scope Ids can be found in shared service administration. You may need to look at some query strings to get the value. I’m not sure where you would look to get the scope ID programmatically.
Tom Clarkson
June 3, 2008 at 1:36 am
Hi
Could you please give me an example how do i search a keyword inside the document and at the same time search in custom columns … quite urgent appreciate ur help
thanks
celerity12
June 3, 2008 at 7:48 pm
@celerity12 – I’m not sure if the keyword search and property search can be combined in that way. I suggest you try to work out what you can do with the out of box advanced search page before you try the customisation. You may get somewhere by looking for a property that includes the document body.
Tom Clarkson
June 3, 2008 at 8:03 pm
I’m not sure if anyone solved the pagng issue. this works great *except* I lose all stage when paging. I must be missing some vital ingredient here.
Thanks,
-Ryan
Ryan
June 11, 2008 at 9:51 am
I meant I that I lose “state” when paging. Because of the strict names of the input text boxes I’m having trouble using ASP.NET controls instead to help maintain viewstate.
Ryan
June 11, 2008 at 11:10 am
The names aren’t actually that strict. They need to be in the form nameprefix$ASB_PS_plb_1, but the prefix is completely ignored by the search result hidden object, which means that it can be whatever asp.net sets the name to automatically when you set the id of the server control to ASB_PS_plb_1.
Tom Clarkson
June 11, 2008 at 3:21 pm
I think the problem may be the ContentPlaceHolder. This is the HTML result of using an ASP:TextBox control inside PlaceHolderMain:
`
__abENT__lt;input name=__abENT__quot;ctl00$PlaceHolderMain$ASB_PS_pvtb_0__abENT__quot; type=__abENT__quot;text__abENT__quot; id=__abENT__quot;ctl00_PlaceHolderMain_ASB_PS_pvtb_0__abENT__quot; __abENT__#8260;__abENT__gt;`Is the prefix messing up the name/rendering?
-Ryan
Ryan
June 12, 2008 at 8:01 am
I’m completely at a loss…
This works: (but no paging)
`
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_pvtb_0__abENT__quot;__abENT__#8260;__abENT__gt;`this does not:
`
__abENT__lt;asp:TextBox runat=__abENT__quot;server__abENT__quot; id=__abENT__quot;ASB_PS_pvtb_0__abENT__quot;__abENT__gt;__abENT__lt;__abENT__#8260;asp:TextBox__abENT__gt;`The asp textbox renders to:
Inside a ContentPlaceHolder: `
__abENT__lt;input name=__abENT__quot;ctl00$PlaceHolderMain$ASB_PS_pvtb_0__abENT__quot; type=__abENT__quot;text__abENT__quot; id=__abENT__quot;ctl00_PlaceHolderMain_ASB_PS_pvtb_0__abENT__quot; __abENT__#8260;__abENT__gt;`Outside a ContentPlaceHolder:`
__abENT__lt;input name=__abENT__quot;ASB_PS_pvtb_0__abENT__quot; type=__abENT__quot;text__abENT__quot; id=__abENT__quot;ASB_PS_pvtb_0__abENT__quot; __abENT__#8260;__abENT__gt;`Neither take my critera for searching. Does one have too many $ delimiters and the other needs one? Ugh…frustrating.
-Ryan
Ryan
June 12, 2008 at 8:30 am
From what I remember from looking at the code in reflector, the prefix doesn’t matter – the srho looks through all the fields posted and finds the ones that include ASB_PS_pvtb in the name.
Use of ContentPlaceHolder suggests that you are putting the code on the master page rather than in a web part. Since I got the values in the original post by looking at the rendering of a web part, that could be the problem.
Tom Clarkson
June 12, 2008 at 4:29 pm
Ok, solved it. Very interesting.
The prefix ultimately needs to match your other fields. For example:
Needs to line up with how this will ultimately be rendered in HTML:
It seems that if the prefixes don’t match each other, the search will ignore or not see the input values it expects to be there. I never would have guessed this, and just got lucky trying different name properties on the hidden inputs.
Once that worked the paging works like a charm, although I’m still confused as to how the Advanced Search Web Part works in conjunction with posting to the Results.aspx page. Paging still works there. I tried to copy this page/process and couldn’t get it to work, but didn’t spend too much time on it.
Thanks again for such a great article, and I really appreciate you replying to the comments.
-Ryan
Ryan
June 13, 2008 at 4:29 am
Just an added comment to the 67 character issue mentioned on 05/28 and responded to on 06/02: not sure if it is related, but the following is true for out-of-box functionality: when using the Advanced Search property restrictions URL , it will only find results for strings occurring in the first 67 positions, and not anything beyond. A case was opened with MS concerning this limitation, and the response was that it was working as designed. Again, not sure if its related, but the coincidence lead me to post this.
pjh
June 18, 2008 at 3:52 am
This is the excellent Bolg!
I am having some issues in creating custom search box. It is working fine with the single drop down (Author) and it is giving a correct result.
But while adding one more drop down for “Title” it does not give any result.
How can I add more than two drop down boxes? I should serch with the multiple columns with “OR” condition.
Please help us to resolve his issue.
Thanks in Advance,
Regards,
R. Manikandan.
Manikandan
June 26, 2008 at 10:36 pm
This is a good workaround and can be applied to a number of web parts but I have two points.
1. If you want to keep all the features of the original form you’ll need to keep the javascript in place for your “Add Property” additions to work.
2. A more robust solution is to grab the original source code from the /bin, save a copy and modify as required. In this way you can deploy the changes as a solution and activate it as a sitewide feature.
I’m in the process of testing a fully accesible version now. When it’s done I’d be happy to post it here if anyone’s inteersted.
Paul Noone
June 26, 2008 at 10:55 pm
@Manikandan – Just duplicate olb, plb and pvtb with a different number on the end.
@Paul Noone – If you want the same structure of the original advanced search box you are better off just using what customisation is available on the standard one. This solution is more intended to produce something with the power of the advanced search but a completely different UI.
For a more robust solution after writing this post I set up a web part that produces the same output based on an xml configuration property, which was fairly straightforward to do.
Tom Clarkson
June 30, 2008 at 2:23 am
Hi Tom,
I’m trying to change the text of the advanced search property filters like (Pick a property),(Add Property),(Where the property).
I tried the client side method but errors occured due to viewstate validation.
Is there any work around to modify those texts? if not how can i impelment a server side solution as the advancedsearchbox class is sealed!!
Ahmed Nasser
July 11, 2008 at 2:30 am
I found a sollution to the problem: “This Page has been modified since you opened it. You must open the page again.”.
Basicly what I needed to get it to work was the ResetPageHashCode function. So I inserted the following on the Prerender of my search web part:
`
string script = __abENT__quot;__abENT__lt;script__abENT__gt;function ResetPageHashCode()__abENT__#92;r__abENT__#92;n {__abENT__#92;r__abENT__#92;n var f = document__abENT__#46;forms[0];__abENT__#92;r__abENT__#92;n if (null != f __abENT__amp;__abENT__amp; null != f__abENT__#46;elements[__abENT__apos;MSO_PageHashCode__abENT__apos;])__abENT__#92;r__abENT__#92;n__abENT__#92;t__abENT__#92;t f__abENT__#46;elements[__abENT__apos;MSO_PageHashCode__abENT__apos;]__abENT__#46;parentNode__abENT__#46;removeChild(f__abENT__#46;elements[__abENT__apos;MSO_PageHashCode__abENT__apos;]);__abENT__#92;r__abENT__#92;n__abENT__#92;t__abENT__#92;t _spFormOnSubmitCalled = false;__abENT__#92;r__abENT__#92;n__abENT__#92;t__abENT__#92;t __abENT__#92;r__abENT__#92;n }__abENT__lt;__abENT__#8260;script__abENT__gt;__abENT__quot;;`this__abENT__#46;Page__abENT__#46;ClientScript__abENT__#46;RegisterClientScriptBlock(base__abENT__#46;GetType(), __abENT__quot;__ASB_SCRIPTS____abENT__quot;, script);
ResetHashCode(); would then be needed to run on the onclick event on the search submit button.
I havent’t tried it in a content editor web part but I sopose you could just put it in a script block within your editor and it would work aswell.
I had this problem with “Search Server 2008″ and not MOSS But should work almost identical.
Hope this helps some of you
Steffen Estrup
July 12, 2008 at 2:48 am
Hello Tom,
very handy! I got i worked with a couple of pulldown menu’s…and now i want to fix it with checkbox..that works but i have a problem with the AND/OR function :S
Thanks for this blogitem
I have a pulldown menu (Status) and then two checkbox (Knowlegde) and I want the following function Status AND (Knowlegde checkbox 1 OR Knowlegde checkbox 2)..but how must I do that? I got the following code:
Status:
`
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_plb_1__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;SWKennisStatus__abENT__quot; __abENT__#8260;__abENT__gt;`__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_olb_1__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;SELECT name=__abENT__quot;nameprefix$ASB_PS_pvtb_1__abENT__quot;__abENT__gt;
__abENT__lt;OPTION__abENT__gt;__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Draft__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Final__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Not Started__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;__abENT__#8260;SELECT__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_lolb_0__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;And__abENT__quot; __abENT__#8260;__abENT__gt;
`
Knowlegde:__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_plb_2__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Knowlegde__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_olb_2__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input type=__abENT__quot;checkbox__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_pvtb_2__abENT__quot; value=__abENT__quot;Kennis 1__abENT__quot;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_lolb_1__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Or__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_plb_3__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Knowlegde__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_olb_3__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input type=__abENT__quot;checkbox__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_pvtb_3__abENT__quot; value=__abENT__quot;Kennis 2__abENT__quot;__abENT__gt;`
Regards
Mark
July 22, 2008 at 2:16 am
Hi Tom,
Great work!!!
Thanks a lot for such a nice article.
But i am facing a problem , the values are not persisting in the controls after firing search.
Can you please help me out in this regard?
Regards
Paromita
July 23, 2008 at 5:08 am
Hi,
Really good blog. But couldn’t do it. I’m struggling to re-create the Advanced search box within the Content Editor Webpart (not an expert on SP). Is it possible that someone upload a sample source code to recreate the advanced search box?
Regards
Faruk
July 25, 2008 at 4:27 am
@Ahmed – This post is about replacing the search box completely. Whenever you have an asp.net textbox you have to modify the options server side or turn off viewstate validation. You shouldn’t need to change the dropdowns you mention as they are fully configurable with xml.
@Mark – Unfortunately there is only one control for specifying the operator – you can’t use both. You may be able to do something similar with javascript and passing in raw sql though.
@Paromita – see other comments regarding using asp.net controls.
@Faruk – try the posts linked from http://www.tqcblog.com/archive/2007/11/16/more-on-customising-advanced-search.aspx
Tom Clarkson
July 28, 2008 at 10:19 pm
Hi Tom
I have tried this to build a custom search page for our site. However, I have attempted to replace the QuickSearch on the masterpage with this. I am using ASP.Net controls for the Dropdown, Textbox and button, and (obviously) HTML Hiddent fields elsewhere. However I am getting Vewstate issues (Validation of viewstate MAC failed). Not sure if I am missing something stupid, but your blog sppears to suggest the use of ASP.Net controls will get around hte viewstate isues. Ay idea what I am doing wrong?
Paul
July 29, 2008 at 5:27 am
Hi Tom my question is are you able to list more then one dropdown and if so is there any additions or exceptions needed to add additional columns/drop down boxes. I.E change 1 to 2, etcs) posting code with an extra column refference would be great too (wishful thinkin) but thanks this article helps alot
Eli RIpoll
July 29, 2008 at 4:58 pm
@Paul – putting it on the master page will change the position in the control hierarchy and give it a different id, which may have something to do with the problem. Check for conflicts with standard controls on the results page. The viewstate problem that using asp.net controls solves is keeping search strings in the textbox. you may need to disable the validation on that control to get it working in your scenario.
@Eli – Yes, adding additional controls works. lolb and srch are the only ones that have a number but can’t be duplicated.
Tom Clarkson
July 30, 2008 at 7:01 am
Thanks that worked!
but a strange thing i have it working fine aon one site but on another with the exact same hierarchy when i click the search button it says the “This Page has been modified since you opened it. You must open the page again” click refresh. i have the page going to a different page in the same folder like the first site but something a miss, have you ever had/seen this issue?
Eli
August 1, 2008 at 4:38 pm
Hi Tom,
Let me know how the advance search webpart and search core results webparts linked. I need to create a custom search and need to diplay the results in search core results webpart( My assumption the saerch is happening in the search core result webpart)
Ajith
August 22, 2008 at 6:01 am
Actually it’s a hidden object that does the search. To connect to that you just have to put appropriately named fields into the form.
Tom Clarkson
August 22, 2008 at 4:27 pm
Tom,
The where the hidden object resides? Can you give the deatils about how the hidden object works? whats the input and output to/from the hidden object.
Ajith
August 26, 2008 at 4:17 am
Tom,
The where the hidden object resides? Can you give the deatils about how the hidden object works? whats the input and output to/from the hidden object.
Ajith
August 26, 2008 at 9:45 pm
Tom,
Is there anyway of getting the webpart to pass the search criteria in teh querystring, like the standard advanced search does? The search and even pagination works fine, but when i click on the modified link up the top to changed sorting, it clears the results.
I can only get this thing working when i have a core results on the same page and the submit button refers to the current page. Is it possible to redirect to the standard results page?
Perhaps the best way forward is to build a server-side web part. Did you jsut copy the code from somewhere int he hive and paste in your web-part as a starter point?
THanks for all you great work.
Paul
August 28, 2008 at 12:54 am
Tom,
The where the hidden object resides? Can you give the deatils about how the hidden object works? whats the input and output to/from the hidden object.
Ajith
August 29, 2008 at 9:32 pm
@Paul – I started by copying the html output of the advanced search box web part then made a control to reproduce that. Are you sure about the search criteria in the query string? The regular search does that using keyword query syntax, but I haven’t seen sql syntax as used by advanced search in the query string.
@Ajith – to get more than is in this article you’ll need to dig around in the SharePoint code using Reflector.
Tom Clarkson
September 19, 2008 at 6:41 pm
Hi Tom,
I added the custom Advanced Search webpart on the Colaboration Portal. But the AutoPostBackwithoptions on Search button click is not working. It just refreshes the page.
Do you have any idea as to what is happening. I am using exactly the same code with same name and id.
Thanks for the article!
Best Regards,
Aaftab
Aaftab
September 20, 2008 at 1:27 am
somebody asked about finding scope ids programmatically..
heres the code snippet
Scopes allScopes = new Scopes(SearchContext.GetContext(SPListHelper.GetCurrentWeb().Site));
Scope myScope= allScopes.GetSharedScope(“myScopename”);
string scopeId = myScope.ID.ToString();
but i still m not sure where the 0 comes from in ASB_SS_scb_0_16
note :as tom said 16 here is the scope ID
Madhur chadha
October 14, 2008 at 9:07 am
note here splisthelper is a custom helper class you could simply use current spsite
Madhur chadha
October 14, 2008 at 9:08 am
Nice Bolg!
I having some issues in custom search box. It is working fine with the single drop down (Author) and it is giving a correct result.
But while adding one more drop down for “Title” it does not give any result. It’s showing error message. How can I add more than two drop down boxes? I should serch with the multiple columns with “OR” condition.
Please help us to resolve his issue.
Regards,
Prabhakar.T
Prabhakar
October 16, 2008 at 4:03 am
You’re probably reusing an id somewhere – make sure you are incrementing the numbers appropriately.
For the operator, try ASB_PS_lolb_0 as described in the original post.
Tom Clarkson
October 16, 2008 at 9:22 pm
Tom & Ryan & John,
Any idea how to get the search results to work with the paging web part? It seems to render the correct number of links for the paging webpart, but clicking on any of them does work.
Let me know the full code using asp.net controls.
Prabhakar
October 16, 2008 at 10:32 pm
I would like to use Result type as word documents only of Advanced search box webpart and limit the results to file extension of doc docx or dot only in search results I am totally new to sharepoint and i dont want to show the drop down to users can someone help me with this.I tried to change the properties in the xml file but it is not showing the relevant results
Reet
October 22, 2008 at 4:12 am
Just found out where the language checkboxes names come from, and thought you might like to know … if you edit the webpart “Modify Shared webpart”, and expand “Properties”, then edit “Properties” property, you will see that this is a blob of XML, where all the available languages (root/LangDefs/LangDef) and the selected languages (root/Languages/Language) are documented. The suffix of the control number corresponds to the LangId attribute in the XML!! Happy coding.
WarrenR
October 23, 2008 at 8:14 am
Hi
The sharepoint searches on the basis of author of the document, modified by, modified date of the document. i dont want a search on the basis of these properties I just want to search on Name and content of the document
How do i achieve this? Please help
Reet
November 4, 2008 at 12:55 am
Thanks Tom, scopes, result types managed properties, every thing worked fine. I was able to recreate and customise the whole advanced search web part.
Awesome post !
Phil
November 7, 2008 at 6:27 pm
Hi, thanks Tom for this, really useful!
To the people with “Validation of viewstate MAC failed” and “This Page has been modified since you opened it” issues: I did a workaround for this using two webparts:
webpart #1, a simple textbox and button situated wherever I want it to be on my site. The button’s onclick event redirects the user to the Enterprise Search Center page named results.aspx with querystrings of the search.
webpart #2, added within results.aspx. Using Page.ClientScript.RegisterStartupScript() and _spBodyOnLoadFunctionNames.push(“myfunction”) where “myfunction” simply calls document.aspnetForm.submit() instead of the onclick event fired in the above example. The `
__abENT__lt;html__abENT__gt;` from the example above is still rendered as usual.So.. this webpart registers some onload javascript which automatically posts the form and cause postback, which in turn will bring up the search results. As a final touch I simply set the webpart #2 attribute to hidden. Make sure to check if !Page.IsPostBack before registering the onload javascript.
maets
November 22, 2008 at 4:01 am
can any one explain how to add pick list on advance search
step by step
Yes all are managed properties
SydLady
November 25, 2008 at 3:59 pm
Hi Tomm,
i have another issue, I want to show only word documents in the search results from a Document Library. for this i have already created a scope and added to the coresearchresults webpart. Problem is that i have a few folders in the Document Library and sometimes they show up in the results…
my previous issue is resolved by adding a required field validator on the webpart
I have tried adding the Result Type dropdown wirh Word Documents as the only value but it doesn’t help..
Any suggestions on this will be appreciated..
Thanks,
Aaftab
Aaftab
November 26, 2008 at 4:37 am
Try doing something with the standard keyword search interface (ContentType:Document etc) – if you can work out the right query to use there it should tell you what you need to set up when customising the advanced search.
Tom Clarkson
November 26, 2008 at 4:13 pm
is there are place like on MSDN to find all the ASB* definitions?
decatec
December 3, 2008 at 6:31 am
There isn’t any official documentation of this that I am aware of. I believe my list is fairly complete, but if you want to go back to the original source you’ll need to use reflector.
Tom Clarkson
December 3, 2008 at 4:10 pm
Hi Tom,
I know a way to restrict the documents as i add -isDocument:0 in Basic search but i don’t know where to add it in my custom advanced search webpart.
Any idea on the same?
Thanks,
Aaftab
Aaftab
December 4, 2008 at 4:41 am
This is a really good post but I have to say I seem to have a problem getting it to work. I tried the HTML approach with a fairly complicated structure and then with a very simple keyword field etc and get the ViewState problem you have mentioned in the comments. So I decided to implement the code on server side but I’m getting exactly the same problem.
Any advice or things I could look at as to why this might be happening.
I’ve included the hidden property fields, the keyword field and submit button. That’s it for now…
stevus_uk
December 4, 2008 at 11:12 am
I juste wanna warn you about the “ASB_PS_olb_*” control :
the attribute “value” depends of the site language.
For example i have
`
__abENT__lt;input name=__abENT__quot;containNameSearch$ASB_PS_olb_0__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; __abENT__#8260;__abENT__gt;`in english Sites and
`
__abENT__lt;input name=__abENT__quot;containNameSearch$ASB_PS_olb_0__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contient__abENT__quot; __abENT__#8260;__abENT__gt;`in french Sites.
PAFleche
December 12, 2008 at 7:27 am
That is correct, though it’s worth noting that it’s not as simple as just translating the words – some languages only translate some fields and use english for the rest.
Tom Clarkson
December 12, 2008 at 4:23 pm
Can we create option list in drop list dynamically..
i.e search by Status
it can be queried from list (i.e jqueried from sharepoint draft,final whatever available and if added more options are availalble
rather just pasting in cewp..
`
__abENT__lt;OPTION__abENT__gt;__abENT__lt;__abENT__#8260;OPTION__abENT__gt;`__abENT__lt;OPTION__abENT__gt;Draft__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Final__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Not started__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
and nextly scope to be added from Scope display group programmically as oob advanced search does so no need to know about id etc..
Thanks – by the way it was indeed good and useful blog
regards,
Sonal Bordia
Sonal
January 24, 2009 at 1:31 am
Anyone tried using dates field
Dates
Search for Items Created after [ ] And Before [ ]
i m getting error
An unexpected error has occurred.
Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Windows SharePoint Services.
anonymous
January 24, 2009 at 1:39 am
Scope
would scope id remain same on every server
for e.g
Scope A on DEV and Scope A on Test Server would have same ID – ???
anonymous
January 27, 2009 at 8:45 pm
You should be able to populate the dropdowns dynamically, although you’ll probably run into validation issues if you try to do it through the content editor webpart. It shouldn’t be too hard if you are developing a custom coded webpart.
Scopes may be the same on dev and prod if they were set up in the same order, but you can’t count on it. You could write code to get the scope ids dynamically, but I’d probably just make sure changing the scope ids is included in the deployment documentation.
I haven’t tried dates, but it’s most likely a localisation thing – trying to parse US dates as AU dates due to mixing locales and date parsing on the client and server.
Tom Clarkson
January 28, 2009 at 1:05 am
I was having the paging problem too… Without wanting to use asp.net controls, I started digging into the issue I was experiencing and taking out a piece at a time. The culprit was my attempt to limit to a scope in the HTML form (`
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; name=__abENT__quot;ASB_SS_scb_0_9__abENT__quot; id=__abENT__quot;Hidden11__abENT__quot; __abENT__#8260;__abENT__gt;`). Once I got rid of this line and just configured the Core Search Results web part to use the scope, the paging problem went away.Hopefully this will help someone pounding their head into their desk too
Trevor
March 8, 2009 at 10:55 pm
Whenever I submit my custom search form, it just refreshes. I’m assuming that it’s actually going to the Results.aspx page, but then getting redirected back to my search form.
Any ideas?
Brad
March 11, 2009 at 10:25 am
Hey Brad, I had a similar issue. Is your custom search form in a content editor web part or is it a custom ASPX page?
Phil
April 22, 2009 at 5:08 pm
Hello Tom,
What I want to do is combine 2 text fields and one date field to refine a search. The first 2 text fields are drop downs. Intersting I cannot get the AND statement to work.
here is the Code:
`
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; name=__abENT__quot;ASB_TextDT_Props__abENT__quot; id=__abENT__quot;Hidden4__abENT__quot; value=__abENT__quot;csgContentType__abENT__quot; __abENT__#8260;__abENT__gt;__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_plb_1__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;csgContentType__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_olb_1__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;body__abENT__gt;
__abENT__lt;strong__abENT__gt;Document Type:��������������������
Release:__abENT__lt;__abENT__#8260;strong__abENT__gt;__abENT__lt;br__abENT__gt;
__abENT__lt;SELECT name=nameprefix$ASB_PS_pvtb_1__abENT__gt;
__abENT__lt;OPTION__abENT__gt;__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;option__abENT__gt;All__abENT__lt;__abENT__#8260;option__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Critical Notices__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Education Resources__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Product Documentation__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Related Documentation__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Release Communications__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Schedules __abENT__amp; Calendars__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Services __abENT__amp; Support__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;__abENT__#8260;SELECT__abENT__gt;����__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; name=__abENT__quot;ASB_TextDT_Props__abENT__quot; id=__abENT__quot;Hidden4__abENT__quot; value=__abENT__quot;csgPrimaryVersion__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_lolb_0__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;And__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_plb_2__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;csgPrimaryVersion__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_olb_2__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;SELECT name=nameprefix$ASB_PS_pvtb_2__abENT__gt;
__abENT__lt;OPTION__abENT__gt;__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Release 3 2008__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Release 1 2009__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Release 3 2009__abENT__lt;__abENT__#8260;OPTION__abENT__gt;
__abENT__lt;OPTION__abENT__gt;Production Environment__abENT__lt;__abENT__#8260;OPTION__abENT__gt;__abENT__lt;__abENT__#8260;SELECT__abENT__gt;��
__abENT__lt;body__abENT__gt;
__abENT__lt;INPUT id=__abENT__quot;Submit1__abENT__quot; onclick=__abENT__apos;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(__abENT__quot;nameprefix$ASB_BS_SRCH_1__abENT__quot;, __abENT__quot;__abENT__quot;, false, __abENT__quot;__abENT__quot;, __abENT__quot;__abENT__quot;, false, false))__abENT__apos; type=__abENT__quot;submit__abENT__quot; name=__abENT__quot;nameprefix$ASB_BS_SRCH_1__abENT__quot; value=__abENT__quot;Search__abENT__quot; __abENT__#8260;__abENT__gt;`
On the Search results page I recieve this error:
Invalide parameter: csgPrimaryVersion. Expect a number. Release 1 2009 is given instead
Not sure what to do with this error.
JD
May 14, 2009 at 7:58 am
hi
I have some question
1. which assmbly you are looking via the
reflector.
2. I would like to customize the Advanced Search
in the following way:
– when a user click search, I am calling a
web service.
– when the web service return I would like
to execute the search of the advanced
search and to use the key words I have
got from the web service.
– to display the results in the grid.
My question is if I can implement that according to your post?
Thanks
Hagai
Hagai
July 14, 2009 at 6:46 am
Hi Tom,
This article is really helpful, but I met a problem when I used the field: “ASB_ResType_Query is set by the result type dropdown and can be used to include some raw SQL.”
In my code, first when I set a filter: ContentType = ‘***’ to “ASB_ResType_Query” it works fine. And I get what I need. But later when I need to expand that, I met problems. I have now several values to match e.g. Cotent Type can be {0}, {1}, {2} …. When I used “ContentType = {0} OR ContentType={1}…”. I got “Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.” Which I think is because the length of the conditions is too long? So I change it to ContentType IN ({0},{1},***). But I still get the same error.
Is it because SQL IN cannot be used in “ASB_ResType_Query” field? Is there any way I can use to set the filter like that? Thanks.
Li
August 18, 2009 at 8:09 am
Thank for this blog. Looks Cool, i need to customize this thing much more, wish me good luck.
Deepak
October 9, 2009 at 9:44 pm
This is a great article and for people like me hacking around in the Advanced Search Box web part it is invaluable. I have an issue with Multi-valued properties. I want to search on the same string across 3 different Multi-valued properties. I have got as far as this:
`
__abENT__lt;table border=__abENT__quot;0__abENT__quot;__abENT__gt;__abENT__lt;tbody__abENT__gt;
__abENT__lt;tr__abENT__gt;
__abENT__lt;td__abENT__gt;
__abENT__lt;input id=__abENT__quot;Hidden4__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Multi1#;#Multi2#;#Multi3__abENT__quot; name=__abENT__quot;ASB_TextDT_Props__abENT__quot;__abENT__gt;
__abENT__lt;input id=__abENT__quot;Hidden5__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Write#;#Created__abENT__quot; name=__abENT__quot;ASB_DateTimeDT_Props__abENT__quot;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; name=__abENT__quot;ASB_ResType_Query__abENT__quot; id=__abENT__quot;ASB_ResType_Query__abENT__quot; value=__abENT__quot;__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Multi1__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_plb_0__abENT__quot;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_olb_0__abENT__quot;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_lolb_0__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Or__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Multi2__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_plb_1__abENT__quot;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_olb_1__abENT__quot;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_lolb_1__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Or__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Multi3__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_plb_2__abENT__quot;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Contains__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_olb_2__abENT__quot;__abENT__gt;
__abENT__lt;input name=__abENT__quot;nameprefix$ASB_PS_lolb_2__abENT__quot; type=__abENT__quot;hidden__abENT__quot; value=__abENT__quot;Or__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;input id=__abENT__quot;nameprefix_ASB_PS_pvtb_0__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_pvtb_0__abENT__quot;__abENT__gt;
__abENT__lt;input id=__abENT__quot;nameprefix_ASB_PS_pvtb_1__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_pvtb_1__abENT__quot;__abENT__gt;
__abENT__lt;input id=__abENT__quot;nameprefix_ASB_PS_pvtb_2__abENT__quot; name=__abENT__quot;nameprefix$ASB_PS_pvtb_2__abENT__quot;__abENT__gt;
__abENT__lt;input type=__abENT__quot;hidden__abENT__quot; name=__abENT__quot;ASB_SS_scb_0_0__abENT__quot; __abENT__#8260;__abENT__gt;
__abENT__lt;td__abENT__gt;
__abENT__lt;input id=__abENT__quot;Submit1__abENT__quot; onclick=__abENT__apos;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(__abENT__quot;nameprefix$ASB_BS_SRCH_1__abENT__quot;, __abENT__quot;__abENT__quot;, false, __abENT__quot;__abENT__quot;, __abENT__quot;__abENT__#8260;en__abENT__#8260;SearchCenter__abENT__#8260;Pages__abENT__#8260;clientmanagerresults__abENT__#46;aspx__abENT__quot;, false, false))__abENT__apos;
type=__abENT__quot;submit__abENT__quot; value=__abENT__quot;Search__abENT__quot; name=__abENT__quot;nameprefix$ASB_BS_SRCH_1__abENT__quot;__abENT__gt;
__abENT__lt;a id=__abENT__quot;anch1__abENT__quot; title=__abENT__quot;Go Search__abENT__quot; href=__abENT__quot;javascript:document__abENT__#46;getElementById(__abENT__apos;Submit1__abENT__apos;)__abENT__#46;click();__abENT__quot; rel=__abENT__quot;nofollow__abENT__quot;__abENT__gt;
__abENT__lt;img onmouseover=__abENT__quot;this__abENT__#46;src=__abENT__apos;__abENT__#8260;_layouts__abENT__#8260;images__abENT__#8260;gosearch__abENT__#46;gif__abENT__apos;__abENT__quot; title=__abENT__quot;Go Search__abENT__quot; style=__abENT__quot;border-top-width: 0px;
border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px__abENT__quot; onmouseout=__abENT__quot;this__abENT__#46;src=__abENT__apos;__abENT__#8260;_layouts__abENT__#8260;images__abENT__#8260;gosearch__abENT__#46;gif__abENT__apos;__abENT__quot;
alt=__abENT__quot;Go Search__abENT__quot; src=__abENT__quot;http:__abENT__#8260;__abENT__#8260;au-dev-moss5:40000__abENT__#8260;_layouts__abENT__#8260;images__abENT__#8260;gosearch__abENT__#46;gif__abENT__quot;__abENT__gt;
__abENT__lt;__abENT__#8260;a__abENT__gt;
__abENT__lt;__abENT__#8260;td__abENT__gt;
__abENT__lt;__abENT__#8260;td__abENT__gt;
__abENT__lt;td__abENT__gt;
__abENT__lt;__abENT__#8260;td__abENT__gt;
__abENT__lt;__abENT__#8260;tr__abENT__gt;
__abENT__lt;__abENT__#8260;tbody__abENT__gt;
__abENT__lt;__abENT__#8260;table__abENT__gt;`
I get as far as this, which is reported in the ULS logs:
Full text sql query id: 0xb700187, text: SELECT AccountName, UserProfile_GUID, PreferredName, JobTitle, Department, WorkPhone, CurrentOffice, AboutMe, PictureURL, WorkEmail, WebSite, Path, HitHighlightedSummary, HitHighlightedProperties, Responsibility, Skills, SipAddress, MobilePhone, AlternatePhone, Extension, FirstName, EmployeeNumber, Muli1, Muli2, Muli3 from scope() where (“scope” = ‘People’) And (Muli1 like ‘%Electricity%’ Or Muli2 like ‘%Electricity%’ Or Muli3 like ‘%Electricity%’) Order By Rank desc
….which looks pretty good to me. That is the query I want.
BUT!!!
The next line in the logs is:
CustomSerch – Exception Occurred: Value does not fall within the expected range.
Is this a shortcoming with multivalued properties? Any suggestions on what I can do would be much appreciated.
BreakDancingKing
October 24, 2009 at 3:58 am
Thanks Tom, Great help!!
Million thanks.
Indrajeet
October 29, 2009 at 5:04 am
Thanks Tom, Great help!!
Million thanks.
Indrajeet
October 29, 2009 at 5:58 am
Hi,
I want to customize search such that I can filter the results based on multiple fields at the same time(like Country, Age and Department).
How can I do this?
I do not have access to the code of server, so its just SharePoint Designer and browser that I can use.
Maybe, this might help. Is it possible to create a scope which can can take values of multiple properties from a textbox?
Any help will be highly appreciated.
Thanks…
Sid
December 3, 2009 at 9:33 am
Hello Tom,
A good tutorial, but I need some check boxes as filters and not need the drop down. How can i have those managed properties or my custom fields as filtering options using checkboxes here in advanced search webpart. Is there anyway to do so?
Thanks a lot.
warm regards,
Ed
Edrex
December 9, 2009 at 12:03 am
Can we use check boxes instead of dropdown.? My requirement is to select multiple checkboxes or value for say Region property. Or should work there and AND should work between properties. Any ideas? How can I do that.
Teena
May 7, 2010 at 5:55 pm
This doesnot persist the search term in the input boxes… I didnot understand how can this be implemented with an asp – text box which is the only possible way the search term can be retained in the input boxes. Need some help on this!!
Sri
July 30, 2010 at 6:45 am
I had the same problem others reported regarding paging when using this inside a Content Editor Web Part. Since I was using a CEWP the dropdown and other input values didn’t persist across posts. I found a workaround using the form web part and a CEWP.
Add a form web part and CEWP to your page. Add all of the hidden inputs to the CEWP and all of the visible inputs to the form web part (text box, dropdowns, submit button). This may not work for all cases because the form web part doesn’t support all input types.
Eric T
November 30, 2010 at 8:11 am
Quick update to my previous post. The only hidden value you need to move from the form web part to the CEWP is name=”ASB_TextDT_Props” .
Eric T
November 30, 2010 at 8:41 am
Hey how abt stemming, Stemming is not working…. can u guide me please, i have 2 doc’s named 1001 & 1002, when i try to search 1001 or 1002 search works fine, however if i try to search for 100, the result should have been 1001 & 1002, in my case the results are not getting displayed….
santhosh
March 7, 2011 at 6:27 pm