Page 1 of 1
Bookends server problem
Posted: Mon Nov 07, 2011 2:25 pm
by cboulanger
Hello, I am trying to use the SQLQuery feature with the bookends server.
Code: Select all
http://localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=thedate=1966
works and returns the formatted citations without any problem. However,
Code: Select all
http://localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=authors=Berger
gives me
Error: Identifier "Berger" is not found.
What am I doing wrong? Same with "SQLQuery=title=social"
Thanks, C.
Re: Bookends server problem
Posted: Mon Nov 07, 2011 4:32 pm
by Jon
Hm, looks OK. Does a Find in your database find Berger in field Authors? Please Reindex your database and see if that helps. If not, you should follow this up off-forum to tech support.
Jon
Sonny Software
Re: Bookends server problem
Posted: Tue Nov 08, 2011 6:42 am
by cboulanger
Hi,
thanks, as suggested, I have contacted you off-forum.
However, my question to the Bookends community would be: I wonder how many are using the Bookends server in "more advanced" ways, such as using the SQLQuery feature - if so, they must have run into the same problem before, if it is not just a issue specific to the local setup here...
Christian
Re: Bookends server problem
Posted: Tue Nov 08, 2011 8:39 am
by Jon
cboulanger wrote:
Code: Select all
http://localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=authors=Berger
You need to put the text you searching for in single quotes
http://localhost:2001/$BEGeT?db=default ... rs='Berger'
Searching for the year doesn't require that, because the SQL parser knows it's a number.
Jon
Sonny Software
Re: Bookends server problem
Posted: Tue Nov 08, 2011 10:52 am
by cboulanger
Thanks, that works!
I had actually tried it with double quotes, which didn't work, and I did not try the single quotes.
But here comes the nex question:
Code: Select all
http://localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=authors='Berger'
gives me
Berger, Peter L., and Thomas Luckmann. The Social Construction of Reality. A Treatise in the Sociology of Knowledge. London: Allen Lane, 1966.
Berger, Peter L., and Thomas Luckmann. Die Gesellschaftliche Konstruktion Der Wirklichkeit. Frankfurt: Fischer, 1987.
Berger, Stefan. The Search for Normality. National Identity and Historical Consciousness in Germany Since 1800. Providence: Berghahn Books, 1997.
Berger, Benjamin L. “White Fire: Structural Indeterminacy, Constitutional Design, and the Constitution Behind the Text.” Journal of Comparative Law (2008)
but if I want to only get references by Peter L Berger and try the following:
Code: Select all
localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=authors='Berger, Peter'
I get "No matches were found."
Re: Bookends server problem
Posted: Tue Nov 08, 2011 10:59 am
by cboulanger
Can it be that the server doesn't like the space character?
Code: Select all
localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=title='political'
will come up with all kinds of titles that contain the phrase 'political culture', but if I try
Code: Select all
http://localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=title='political culture'
"no matches are found".
Re: Bookends server problem
Posted: Tue Nov 08, 2011 11:14 am
by cboulanger
Seems like this works:
Code: Select all
http://localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=title='political' and title='culture'
So i can do
Code: Select all
http://localhost:2001/$BEGeT?db=default.bdb&format=MLA&SQLQuery=authors='berger' and authors='peter'
and I correctly get
Berger, Peter L., and Thomas Luckmann. The Social Construction of Reality. A Treatise in the Sociology of Knowledge. London: Allen Lane, 1966.
Berger, Peter L., and Thomas Luckmann. Die Gesellschaftliche Konstruktion Der Wirklichkeit. Frankfurt: Fischer, 1987.
But that seems an arkward workaround...
Re: Bookends server problem
Posted: Tue Nov 08, 2011 11:32 am
by Jon
That's not an awkward workaround at all, that's how SQL works. You need a boolean operator between the search words. Bookends is just feeding the search to the SQL parser built into the database engine. If you are going to use SQLQuery, which is very powerful, you have to know how to construct SQL searches. Bookends has some information in the User Guide (and info on regex searching), but there are thousands of web sites that will give much more detailed information on how to create SQL search requests.
Jon
Sonny Software
Re: Bookends server problem
Posted: Tue Nov 08, 2011 12:36 pm
by cboulanger
HI Jon,
but in a MySQL database, for example, I can write a sql query such as
SELECT .... WHERE authors = "Berger, Peter"
to retrieve all entries from this author and do not have to write
SELECT .... WHERE authors = "Berger" and authors = "Peter"
(actually, the corresponding MySQL query would be authors LIKE "%Berger%" and authors LIKE "%Peter%", but Valentina seems to work differently)
The second query is functionally different from the first and will retrieve records that are authored by John
Berger and
Peter Doe, too, which is not what I want.
My problem was that the bookends server seems to not correctly process the space character or that I don't know how the space character needs to be encoded for it to be correctly processed.
I think it must be possible to write authors='Berger, Peter".
Do you see what I mean?
Thanks,
Christian
Re: Bookends server problem
Posted: Tue Nov 08, 2011 12:56 pm
by Jon
No, you can't use the = for that assignment because these fields in the database are indexed by word, and = initiates an indexed search in Valentina (meaning, you can't search for phrases because each word is searched for independently). For a non-indexed search you need to use REGEX. Look in the User Guide for REGEX searching (start on p. 276). There are example given, including doing case-insensitive searching, and links to the IBM ICU library pages that give all the rules.
SQLQuery REGEX searching is quite powerful and flexible, and is offered in Bookends Server for people who need it. If you don't, stick with the simpler Query. Check out p. 321 and 322 in the User Guide for more info.
Jon
Sonny Software
Re: Bookends server problem
Posted: Tue Nov 08, 2011 3:15 pm
by cboulanger
Ok, now I begin to see the light. Valentina IS very different from "normal" SQL databases then.
It might be a good addition to the "Server" section of the User Guide to alert people to this. The guide is very detailed and not everyone reads the entire manual and is able to see the connections.
All right, I'll try the RegEx search options...
Thanks for the good support, as always,
Christian