As of this writing, PHP is the 6th most popular programming language (after Java, C, C++, C#, and Objective-C). A couple years back, it was at 4th position. I consider it to be a most popular web programming language. Till Jul 2007, 20,917,850 domains and 1,224,183 IP addresses had been registered for PHP sites. Searching sites created with such a popular technology with one of the world's best search technologies really makes sense. Especially in enterprise environments, where you are usually tasked with such requirements, this kind of combination does not seem illogical. Steps for setting up PHP search are as following:
1. Open SharePoint Central Administration site.
2. Click General Application Settings.
3. Click Farm Search Administration.
4. Click Search Service Application.
5. Click Content Sources under Crawling in the left side menu.
6. Click New Content Source.
7. In Name field, enter PHP.
8. In Content Source Type, select Web Sites.
9. In Start Addresses, enter the start address of the site that you want to crawl. If you have PHP setup in the local environment, you can enter the local address, for example, I have it set up locally so I entered http://127.0.0.1:8080. If you want to search an external PHP website, enter the address of that website. For example, I have a public website developed in PHP and I wanted to fetch results from that site therefore I entered the URL of my public site (which is http://walisystemsinc.com if you are curious to know). Once you have entered the starting address, you can move on to the other properties.
10. In Crawl Settings, you have three options:
i) Only crawl within the server of each start address
ii) Only crawl the first page of each start address.
iii) Custom - specify page depth and server hops.
You can choose the option that suits your needs. Selecting the first option will allow you to search the whole site starting at the start address you provided. Choose first option.
11. In Crawl Schedules, you can schedule a crawl. You can schedule both Full Crawl and Incremental Crawl. Click Create schedule link under Full Crawl drop down.
Figure 6: Manage Schedules |
12. You can select priority of this content source in Content Source Priority. By default, it is set to Normal. You can change it to High.
13. Click OK.
14. Right-click PHP content source and select Start Full Crawl. It will take a few minutes for the crawling to complete depending on the number of pages in the site. You can click the Refresh link to see updated status during the crawling process.
Figure 7: Start Full Crawl |
15. Click File Types under Crawling. Make sure PHP is listed as one the file name extensions. If it's not there, click New File Type link at the top and enter php in the File extension field. Click OK.
16. Next, create a new Result Source for PHP search. Click Result Sources under heading Queries and Results. Creating new result source will let you apply filters on the search results.
17. Click New Result Source.
18. Enter PHP Search in Title. Enter Search PHP Sites in Description. In Protocol, select Local SharePoint (which is the default selection anyway). In Type, select SharePoint Search Results. If you want to apply filters to the search results, click Launch Query Builder and add filters otherwise move ahead. Keep Default Authentication selected in Credentials Information. Click Save to save the settings.
1. You are now ready to test the PHP searching. Before that, make sure the content has been crawled otherwise no results will appear in the search. Go to the SharePoint site. Go to Site Settings > Site Contents. Go to Pages library. If you don't see Pages library that’s because you have not enabled SharePoint Server Publishing feature in Site Settings. To enable that feature in site settings, first you have to enable SharePoint Server Publishing infrastructure feature in site collection features.
2. Select FILES tab. Click New Document button. Enter Custom PHP Search in Title. Enter phpsearch in URL Name. Default selection in Page Layout is (Article Page) Body only. Click Create.
3. Add search web part to the page. Click EDIT from the top right corner. Click INSERT tab. Click Web Part button. Select Search from Categories. Select Search Box from the Parts. Click Add button.
4. Go to web part properties. Select Send queries to a custom results page URL. In Results page URL, enter /searchcenter/Pages/phpsearchresults.aspx. Replace searchcenter in the URL with your actual search site name. Make sure there is no querystring at the end of the URL. Click OK. This page has not been created yet. You will create this page now.
5. Create another page following the instructions given above. Name it PHP Search Results and enter phpsearchresults.aspx in the URL.
19. Go to the new page. Edit it and add a web part following the instructions given above. This time add Search Results web part. After adding the web part, edit its properties. Click Change Query button. In the Select a query drop down, select the result source (PHP (Service)) you created in the previous steps. In the Keyword filter, select Query from the search box. Click OK. Click Save button in the ribbon to save the page.
20. Go to the PHP search page and enter a search term and hit search. You will see results from the PHP site.
Figure 8: PHP Search Results |
Search is one of the top selling points for Microsoft and SharePoint. As I mentioned previously, SharePoint has one of the best search technologies in the world. No doubt, several big enterprises decide to buy SharePoint because of its excellent search capabilities. These companies know the importance of good quality data. Data is the basis for all research endeavors. Useful data helps stakeholders in their decision making. Collecting good quality data plays a vital role in supplying objective information for analytical understanding of the decision making problems and hence solutions can be obtained for such problems. Big companies value good quality data because making decisions on the basis of poor quality data is risky and may lead to disastrous results. Only good quality data can be used to generate information which helps stakeholders in solving their analytical problems.
SharePoint allows you to setup search so that you can retrieve data from any kind of data source. You can get data from SharePoint sites, external sites, and even line of business applications. There are two parts to setting up line of business search. First you need to setup an application that will fetch data from the line of business application. This is done using Business Connectivity Services. Then you setup search to surface data from the external content types. You can learn more about Business Connectivity Services and External Content Types in the chapter that just focuses on this topic. I am going to skip that information in this chapter. If you want to explore this topic further, I would suggest you go back and read the dedicated chapter on this topic first and then come back to setup search.
You have seen how you can setup search in SharePoint to search external websites or non-SharePoint websites in your local environment. In this section, you will learn to setup search that will surface data from line of business applications. Most enterprise-scale web applications store their data in databases. If you have setup external content types, then you are ready to setup custom search to dig these content sources.
1. Open SharePoint Central Administration site.
2. Click General Application Settings.
3. Click Farm Search Administration.
4. Click Search Service Application.
5. Click Content Sources under Crawling in the left side menu.
6. Click New Content Source.
7. In Name field, enter BCSSearch. BCS stands for Business Connectivity Services.
8. In Content Source Type, select Line of Business Data.
9. In External Data Source select the business data connectivity service application from the drop down. If you have multiple search applications, you will see all of them listed here. If you only have the default service application then that will be selected by default.
10. There are two options for the crawling. One is to crawl all external data sources in the Business Data Connectivity Service Application and the other is to crawl selected external data source. You may have an inclination to select the first option but there is a problem with the first option. Crawl results in the following error:
Directory links across partitions are now allowed.
As of this time, there is no known solution to the problem except to crawl selected data sources. So, choose the second option Crawl selected external data source and check the sources that you want to search.
11. Click Create Schedule under Full Crawl (in Crawl Schedules section) and set up a schedule and click OK.
12. Click Ok.
13. On Manage Content Sources page, right-click BCSSearch content source and select Start Full Crawl. It will take some time for the crawling to complete depending on the amount of data in the external content sources. Once the crawl is complete, right-click BCSSearch and select View Crawl Log. Look at the Errors column. If the number is greater than 0, click the number to view the errors. Column Successes show the number of successful crawls. When you click the number under Errors, you see the error count and the message. Click the error count again to view the detailed error message.
Figure 9: Click error count to view detailed message |
Figure 10: Error while crawling LOB contents |
This error occurs if the service account does not have permissions on one or all of the external content type objects. To see how to resolve this issue, read the chapter on Business Connectivity Services. This error and its solution have been discussed in detail in that chapter. Once you have resolved the issue, start the crawl again.
14. Go to SharePoint site and create search pages to test the line of business search. I am not going to repeat the steps again. Please read previous sections if you are not sure how to create search and search results pages. Once you have created the search results page and added the Search Results web part, edit the web part properties and click Change query button.
15. Select Local SharePoint Results (System) in the query drop down. By default, Query text box has {SearchBoxQuery}. After {SearchBoxQuery} enter ContentSource:BCSSearch in the Query text box. This will return results only from the content source that you specifically created for searching line of business data. Click OK to save the changes.
Figure 11: Limit Search to BCS Content Source |
16. Go to the search page and enter a search term and hit search. You will see results from the external content types.
Figure 12: BCS Search Results |
No comments:
Post a Comment