I have a few Plone sites with Archetypes-based contents.
I noticed that the vanilla portal_catalog search form (manage_catalogView) allows to filter by language, portal_type (one!) and path only - since these are always available.
Thus, whenever I need a quick search by any other criteria, this involves programming, e.g. writing a throw-away Script (Python).
Is there some extension which provides a generic search form, offering all configured search indexes? E.g.:
Search for IDs
Search for Creator
Search for creation time (two fields, for min and max; one of them or both could be used)
review state (use the distinct values for selectable choices)
...
Perhaps I missunderstood your question, but you don't need external methods for a catalog search or a custom extension.
You can use a python script object and call it right from url.
Go to ZMI root, add a Script(python) using the selection field in the upper right corner. Give an id and delete the example content.
Use the examples for queryCatalog or searchCatalog you will find in http://docs.plone.org/develop/plone/searching_and_indexing/query.html
and call your script using the TEST Tab or form URL.
Example:
In ZMI Root Folder, I created a python script called my_test
catalog = context.portal_catalog
from DateTime import DateTime
# DateTime deltas are days as floating points
end = DateTime() + 0.1
start = DateTime() - 1
date_range_query = { 'query':(start,end), 'range': 'min:max'}
query = {'id': ['id_1', 'id_2'],
'Creator': ['creator1', 'creator2'],
'created': date_range_query,
'review_state': ['published', 'pending']}
results = catalog.queryCatalog(query)
for brain in results:
print brain.pretty_title_or_id()
return printed
Finally, if you set some parameters into your python script you can also pass them through URL or the TEST tab.
Hope it helps you
Related
I am attempting to capture all the list items in the WebList elements throughout the entire application, however, while below code works on the WebLists, it does not work on this WebEdit.
When you click on the WebEdit, a long list of values appear (similar to a WebList) and as you type for your value, the list becomes shorter. That is how the WebEdit was set up.
But now, how do I get the values in this list?
Here is the code I have for the WebLists:
Code
Set WebLink = Browser("browser").Page("page")
listval = WebLink.WebElement("xpath:= ((//*[contains(text(), 'Name')]))[1]/following::SELECT[1]").GetROProperty("all items")
listvalues = split(listval,";")
For j = LBound(listvalues,1) To UBound(listvalues,1)
'Print listvalues(j)
writeToTextFile(listvalues(j))
Next
ExitTest
The short answer is: it depends on the implementation.
The long one:
There is no universal widget for comboboxes (Like there is for edit fields or lists / selects, radiobuttons etc) => there is no universal solution but only guidelines.
You need to spy on those objects that appear in the combobox, see their XPath and / or other properties (the css classname they belong to, for example) and then execute a second query that selects all such items. Afterwards you have to extract the value of the selected elements; which might be as simple as getting the innertext Property or you may need to dig even deeper in the HTML hierarchies.
You would need to pay careful attention for synchronisation(Waiting until all search result elements appear), Filtering (using the XPath, Description Objects and ChildObjects method on your WebPage) and then extraction( getting the property /element that contains the actual value of that WebElement)
So again: These combobox solutions are not universal therefore without seeing their code the best what one can provide to you is universal guidelines which should work in most of the situations. (You would need some familiarity with Web Programming and the UFT Framework / Robot)
I have a report card written in Word that uses an XML file for its input. In the XML file, if a student remains in the same section all three trimesters there will be one node for that class; if they change sections at the trimester they'll have one node for each section. The nodes look something like this (greatly simplified):
<ReportCardSectionFB Abs1="2" Abs2="11" CourseID="ELMATH1" CourseTitle="Math" PeriodStart="3" TeacherName="Jones, Jennifer" TermCode="Year" SectionID="ELMATH1-4" />
<ReportCardSectionFB Abs1="1.50" Abs2="6" CourseID="ELMATH1" CourseTitle="Math" PeriodStart="3" TeacherName="Smith, Tina" TermCode="Year" SectionID="ELMATH1-3" />
There is no indicator within the XML as to which trimester the node belongs to.
In the Word document, we're pulling the absence data with the following mail merge command:
{MERGEFIELD "ReportCardSectionFB[#PeriodStart='3']/ #Abs1" \# 0.# \* MERGEFORMAT }
That's not working in this situation: it only gets the absence data from the first node it comes across, i.e.: 2.0. Is there a way to get the sum of #Abs1 for all period 3 classes, i.e.: 3.5? If not, is there a way to only get the last #Abs1 for period 3, i.e.: 1.5?
I recommend you to use this 3rd party product, which can use xml as input and is capable of merging it with MS Word template. I is also much more powerful than the built-in Word's mail merge. You can see some examples here.
You could also try summing the absences in Synergy - there's a new checkbox under AttDef1, 2, etc. that adds up all the absences for the data range - Include all day data for the entire date range regardless of section enrollment or section timeframe. That way the absences should be the same for each section, if that works for your district.
You can also try the SET function in Word to nest the MERGEFIELDS as bookmarks and use the Word operator functions to then add the bookmarks.
I have a view control and make the query string by the search param from the application layout control.Full text index is already enabled, the code in the search property like below:
var queryStr="";
if(param.option=="byName"){
queryStr="[name]="+param.search;
}
else{
queryStr="[title]="+param.search;
}
return queryStr;
i found that the queryStr can be made correct,like "[name]=Vincent",but the view shows all documents contain the word "Vincent",not only the spesific field "name". Just like I used "Vincent" for search.
I want to know how to get the correct result.thank you!
Should it be?
"[name] CONTAINS "+param.search;
similar to this:
[Projectname] CONTAINS top secret
Use the word CONTAINS rather then = ?
I'm not 100% sure but there was a recent blog post on seaching just the other day: http://lostinxpages.com/2014/05/15/exporting-to-excel-using-queries-in-xpages/
Finally I find the problem. The full-text syntax works fine, both "field/FIELD/[]" or "contains/CONTAINS/=" can work. But I used an application layout for search. The search button generate two parameters: "option"(if you choosed before) and "search" by default. The search parameter is used as the value of the view control's search property directly. When I customed this property by myself ,it would not be used(if the ssjs return a null) or generate an " not understandable" error(if the ssjs return a string,which is normal in most situation). The solution is give that two parameters custom parameter name .like fieldName for option, searchText for search. After that, you can use param.fieldName and param.searchText to build your full-text search string.I have tried ,and it works fine now.
For the most part David Leedys answer should work. Some pointers on diagnosing FTI issues though.
1. Your search phrase must be surrounded by quotes. Example:
queryStr='[name] = "' + param.search + '"';
2. Get the actual fully constructed search string and test it in the Notes FTI search bar. Do you get the same incorrect results? If so, then fix the search string.
3. If it is working in the Notes client then add the following debug to the Domino servers notes.ini file (alternatively: set config from console).
Debug_FTV_Search=1
When you run a search it should generate debug like this: Search [name] CONTAINS "String"
IN FTGSearch
[22E8:008A-1710] option = 0x400219
[22E8:008A-1710] Query: ( FIELD name CONTAINS "String")
[22E8:008A-1710] Engine Query: ("String"%STEM#F134)
[22E8:008A-1710] GTR query performed in 10 ms. 2 documents found
[22E8:008A-1710] 0 documents disualified by deletion
[22E8:008A-1710] 0 documents disqualified by ACL
[22E8:008A-1710] 0 documents disqualified by IDTable
[22E8:008A-1710] 0 documents disqualified by NIF
[22E8:008A-1710] Results marshalled in 8 ms. 2 documents left
[22E8:008A-1710] OUT FTGSearch error = 0
[22E8:008A-1710] FTGSearch: found=2, returned=2, start=0, count=0, limit=0
[22E8:008A-1710] Total search time 22 ms.
You want to check the Query and Engine Query from client search vs XPage to see what is generated. If they don't match, update your question with the results so we can see what's going on.
The disqualified section tells you if search results were dropped. For example, if your XPage was running under credentials that were not allowed to view the documents, then disqualified by ACL would have a value.
4. The Notes client has two search syntax methods. There is "Notes" and "Web" style. By default for R9 (and R8.x IIRC) is Web style (client). The server uses Notes style.
You can change the client behavior in the Basic Settings preferences.
The Web style does not understand Notes syntax unless the first word in the search is a reserved keyword and all in uppercase.
Example.
Will use "web" search: field name contains "string"
Will use "Notes" search: FIELD name contains "string"
I am not sure if that impacts XPiNC though (never tested it).
Been looking all over the place for a solution to this issue. I have a Yahoo Pipe (http://pipes.yahoo.com/pipes/pipe.info?_id=e5420863cfa494ee40e4c9be43f0e812) that I've created to pull back image content from the Bing Search API. The URL builder includes a $skip attribute that takes an integer and uses it to select the starting (index) point for the result set that the query returns.
My initial plan had been to use the math engine in the Wolfram Alpha API to generate a random number (randomInteger[1000]) that I could use to seed the $skip value each time that the pipe is run. I have an earlier version of the pipe where I was able to get the query / result steps working using either "XPath Fetch" and "Fetch Data". However, regardless of how I Fetch the result, the response returns as an attribute / value pair in a list item.Even when I use "Emit items as string" in XPath Fetch, I still get a list with a single item, when what I really want is the integer that I can plug into my $skip attribute.
I've tried everything in Pipes I can think of, and spent a lot of time online looking for an answer. Is there anyway to extract text (in this case, a number) from a single list item and then use the output as input to "wire" a text parameter in another Pipes block? Any suggestions / ideas welcome. In the meantime, I'm generating a sorta-random number by manipulating a timecode hash, but it just feels tacky :-)
Thanks!
All the sources are for repeated items. You can't have a source that just makes a single number.
I'm not really clear what you're trying to do. You want to put a random number into part of the URL string that gets an RSS feed?
I'm new to Entity Framework, LINQ and lambda expressions. I need to do a search over a user's table, and I need to emulate one that already exists on a desktop application. This search gives only 1 text field, and then it takes anything that you put in it and creates a "contains" query on different users' attributes like name, last name, username, etc. The most important part is that if you put two or more words in then the search makes the query search for different words.
Example:
If I search for "ju pe" I will get "Perez, Juan", this works by the identification of blank spaces.
Using regular SQL I can build a regular string containing the query, but how can I do that using lambda?
In other words, how can I get a dynamic number of "evaluations" on the .where()? Like .Where(EV1 || EV2 || EVn)
There is neat library called LinqKit which contains predicatebuilder
Sample code:
var predicate = PredicateBuilder.True <User> ();
predicate = predicate.Or(x => x.Name.Contains("ju"));
predicate = predicate.Or(x => x.Name.Contains("pe"));
// etc ...
Users.AsExpandable().Where(predicate);
You can and/or as much as you like.
You can do this using simple Linq by building a complex Where predicate, if I understand you correctly. Please let me know if I misunderstood you! Let's say you have a string searchTermInput and users, an IEnumerable<User> for some type User with a Name string property. Then you can write:
users.Where(user => searchTermInput.Split(' ')
.All(searchTerm => user.Name.Contains(searchTerm)));
In other words: for each user, check if that user's name contains every one of the search terms and filter it out if it does not.