Marco Bravi wrote:
Dear Abdel,

Hi Marco, putting the developer list in copy...

I would stress even more what I said the other day about the selection
of multiple bib entries with same author.

The problem with this "regressed" behaviour is, potentially, much more
serious. Consider this:

- the default behaviour of pybliographic when you add article entries by
hand is to generate the key from the sequence of the initial letters of
the last names of all the authors, so that the key is by no means
related to the first author last name. I have a few files keyed by
myself generated this way and which I cannot use anymore (often, the
first author is... the least known of the group!)

- you may happen to find/receive/share bibliography files created by
other people, who have their own habits in choosing the keys (which,
after all, are hashes...).

At this point, I really think that the current behaviour can not only
limit the power of the "Insert citation" dialog, but even render it
useless.

I understand.

Suggestion:

I think the new behaviour (automatic selection of the matching records)
is perfectly ok. However, all the records matching the typed string in
any part of it (authors, title, journal... just if it were a single
string) should be matched.

If the record info is divided into multiple internal memory fields
(which I think it is), an idea could be to just have LyX search all of
these fields.
That would be quite easy to implement I guess. But I am worried about performance because this is "search as you type". Could you please check if performance is OK with this patch?

Anybody who is using big Bibtex databases? Jurgen? Georg? I need testers...


The real "power search" could be, later, to add some limitation (search
only among author names, or article/book titles...). For now, I think
that a general search is satisfactory and leaves current users of LyX
without being scared of the new version if they have a good amount of
bibliography files with strangely generated hashes laying around.

That would be for later...

Abdel.

Best regards from

Marco




Index: QCitation.C
===================================================================
--- QCitation.C (revision 17419)
+++ QCitation.C (working copy)
@@ -113,8 +113,20 @@
 
 void QCitation::findKey(QString const & str)
 {
-       QStringList sl = available_keys_.stringList().filter(str, 
Qt::CaseInsensitive);
-       found_keys_.setStringList(sl);
+       QStringList keys = available_keys_.stringList();
+       QStringList result;
+
+       // First search within the key info:
+       for (int i = 0; i < keys.size(); ++i) {
+               QString info = getKeyInfo(keys[i]);
+               if (info.contains(str, Qt::CaseInsensitive))
+                       result += keys[i];
+       }
+
+       // Then add also the matching keys:
+       result += keys.filter(str, Qt::CaseInsensitive);
+
+       found_keys_.setStringList(result);
 }
 
 

Reply via email to