Lucene Search based on filename

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2009 08:12 AM
Hi,
Can anyone help me out ..
I am using web service to search a file in alfresco repository, here's the code:
I am passing file name from a custom search page without extension as
for ex:
[just like search in alfresco DMS web client filtered on filename only]
Suppose i have two files File1.txt and file1.pdf and i want to search both the files just by passing file1 as my searchText
I tried the same thing, query returns nothing. And when I tried searching as File1.txt, query returns the exact file.
What could be the possible modification I should do with the above query to get my expected result.
Any suggestion appreciated
Thanks in advance
Can anyone help me out ..
I am using web service to search a file in alfresco repository, here's the code:
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService(); // Create a query object, looking for all items with alfresco in the name of text Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/cm:" + searchText + "\""); // Execute the query final Store STORE = new Store(Constants.WORKSPACE_STORE, "SpacesStore"); QueryResult queryResult = repositoryService.query(STORE, query, false); // Display the results ResultSet resultSet = queryResult.getResultSet(); ResultSetRow[] rows = resultSet.getRows();
I am passing file name from a custom search page without extension as
searchText
for ex:
[just like search in alfresco DMS web client filtered on filename only]
Suppose i have two files File1.txt and file1.pdf and i want to search both the files just by passing file1 as my searchText
I tried the same thing, query returns nothing. And when I tried searching as File1.txt, query returns the exact file.
What could be the possible modification I should do with the above query to get my expected result.
Any suggestion appreciated
Thanks in advance
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2009 06:37 PM
Maqsood,
Try to search "File1", it should return both the entries - "File1.txt" and "File1.pdf".
Try to search "File1", it should return both the entries - "File1.txt" and "File1.pdf".
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2009 03:25 AM
If you want to search for name only:
+@cm\:name:*file1*
and if you additionally want to reduce the search to the direct descendants of company home:+@cm\:name:*file1* +PATH:"/app:company_home/*"
This site http://wiki.alfresco.com/wiki/Search explains a lot.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2009 10:56 AM
Thanks alot for your help guys.
Refering wiki resolves my problem. One more question I want to clarify may be Its there in wiki but i am not able to make out any solution.
Before displaying the result, How do I check user has enough permission to view the file(s) :?:
I want to show the result iff user has permission to view the file otherwise some message.

Refering wiki resolves my problem. One more question I want to clarify may be Its there in wiki but i am not able to make out any solution.
Before displaying the result, How do I check user has enough permission to view the file(s) :?:
I want to show the result iff user has permission to view the file otherwise some message.
