Search Box Webpart - Default to a custom search scope - sharepoint

I've two search box webparts in a same page targeted to different audiences. I want to configure the search boxes to seach a specific search scopes which I've created.
Any ideas how to do that?

Typically the search box points to the page with the desired search results web part. That is a problem if you want both search boxes to point to the same page. You might look at using web part connections and have 2 pairs of web parts - search box and results "A" and "B" where the "A" pair uses a connection to define the link. Then the result part "A" would select the desired scope and/or audience and so forth.

I've created a custom search control which redirects to the search page. I've passed all the necessary details such as keyword, scope etc in the URL.

Related

Is there a way to send a filter to a Sharepoint List and view the results in a web part?

I've been tasked with setting up an advanced filter for a customer facing portal - as part of this, I have filters set up for various tags such as Priority, Site, Application, Reference. I've come up with a way to generate a URL that goes to the list and sets the filters to the selections given, by giving an html navigation command using a JavaScript function to splice together the URL.
This works fine for use within my team, however customers shouldn't have full access to our lists, and we have a customer-facing portal that currently has a limited view of these lists displayed to them, with much fewer details and none of our internal notes. These limited views are done through a web part that displays the Soaped in view - this is where I'm wanting to have the filtered list show up, as it's a more user-friendly way to search the list for information that the customer would want.
You can add a Query String (URL) Filler Wepart to the page, configure it for the param in the URL and configure connection or the List WebPart to receive filter value from the Query String Filler.
Add QSF webpart:
Configure the WP:
Establish Connection (go to the WP Edit mode first)
Test the URL param: ...sharepoint.com/sites/dev/SitePages/TestPage.aspx?Disp=1

Get listitems from Current Site

I am trying to create a Page Layout, that should have a lookup field. Lookup field should always get populated with a list's items.
This list will exist in all subsites, so whereever I create this page, list should get populated with listitems from current site.
I tried using site column lookup field, but it always point to list under top site and not the current site.
Any suggestion on how to make it work or better alternative? Thanks!
Let me know if I can provide more info.
The most straightforward solution I can think of is using a cross site lookup column and creating a seperate fields for each subsite. However, you will need to create and use different Page Layouts for each subsite.
You can use http://sp2010filteredlookup.codeplex.com/ for cross site lookups.
Solution 1 - Use http://sp2010filteredlookup.codeplex.com/
Use filtered lookup solution. So let's say you have your custom Page Layout and custom Page Content Type.
Every time you create new subsite, you should remember go to Pages list settings and edit Page Content Type by adding cross site lookup (with the same field "internal name").
So you still have one Page Layout (and one Content Type). But for each Pages library instance, Content Type contains diff fields (but with the same Internal Name). It will allow you run CAML queries and other things needed without any problems.
Solution 2 - develop custom sharepoint field type.
In edit mode, control will render "dropdown list" and populate data from list instance that is on current subsite. In the field settings you can have relative list url.
Solution 3 - hidden text field / js snippet solution
Page Content Type can contain hidden text field (it can contains selected field value in json format for example). Develop js snippet that will handle all the logic (rendering in edit/view mode, saving etc) and put it on Page Layout (aspx).
I would suggest to use solution #1 or #2.

Sharepoint 2010 Search - Auto add property to QueryString

Have a bit of a difficult question which as far as I can see, no one has really managed to fix yet.
Here's the scenario. Sharepoint 2010 EnterPrise Search Centre.
I've created a custom Search Results Page. I want people who type any word in the Search box to only display results where the Value provided by the user matches with a specific Managed Search Property.
Now I know a user can search for People with specific criteria by entering for example
Continent:Europe in the actual Search Box. Sharepoint will refresh the page with the following added to the Query String: k=Continent:Europe and the results will only show people who are from Europe.
So my question is : How can I fix this so that the user does not have to enter the Continent:Europe in the Search box and can just type Europe?
Thanks
One option is to create your own webpart that acts as the search box and replaces the standard one with your custom search box. The advantage of this is that you can more tightly control the user interface and then set up the query passed to the server (with the "k" parameter). You could prepend "Continent:" before the search term entered to help narrow the search.
Another use for this is to append * onto any search term because the People search does include partial words by default.
We did this on one site to simplify the input and allow users to search with one text box (without the advanced features) and then users can use the refinements to narrow the search.

Google-Analytics API to track Site Search?

So there's this nifty _trackPageview() api method on a tracker object, but is there a corresponding method that can be used to manually track a search? In other words, _trackPageview() reports to GA that a user hit a page. I want something like _trackSearch("terms") that would report to GA that a user searched for something.
Though not exactly what I was looking for, it seems that one can generate virtual page views to track search results programatically.
Suppose that you've set up a Site Search parameter called "q", so that when a URI is tracked that contains q=these+are+some+terms, GA will mark it as a search hit. One can use the _trackPageview() method to generate virtual search hits like so:
pageTracker._trackPageview('/custom/search?q=These+are+some+terms')
I pass search parameters by GET, so the URL for a search on "TEST" is
http://www.example.com/search?q=TEST
Selecting Content -> Site Search from my analytics account gives me a list of all keywords searched.
To learn more, check the documentation, especially the How do I set up Site Search for my profile? page.

MOSS 2007 Search Center. Altering Scope of a Search

I'm creating a new Sharepoint Site Collection and as a subsite I have a Search Center.
After creating a new Content Search (File Share), I can search this using the Dropdown from the Home Page.
Searching "sharepoint" with Scope "All" : returns 4 items
Searching "sharepoint" with Scope "ISOs and Tools" : returns 2 items
Now I'm trying to configure the Search Center to use this search scope. But everytime I make a search, the results are returned as I had selected the scope "All", that means, 4 items!
How can I configure the Search to go on a specific scope?
Thanks in advance!
If you mean that the default search page in the search center always searches the 'all' scope - well, it does!
If you edit the page you should be able to edit the properties of the search box. In those properties you can append to the search query 'Scope:' and the name of your scope. This scope will show up in your results page's search box, though.
Alternatively, create a new results page. In the search core results web part you can set the scope you're using for the results - it is a miscellaneous property.
You'll then need to edit your search center's home page to point the search box there to your new results page, and to do likewise on the new results page itself.
See http://andrewwburns.com/2009/02/20/search-a-single-list-and-dont-use-the-osssearchresultsaspx-page/
Make sure you have reset/recrawled your content through the shared services admin.
Make sure you are restricting your Scope to the proper content source by adding a "ContentSource" rule in the SiteCollection's search settings
Make sure you have updated your scopes in shared services.

Resources