Question regarding feature in addressee module

0 views
Skip to first unread message

Dennis Riedel

unread,
Mar 15, 2010, 5:11:26 PM3/15/10
to dev-un-informedorg
Hi
The wiki says: "Search filters with livesearch for names as well as clauses/documents"

Ok, names I get. Documents have a code, we could use that one for live search. But what is it with clauses?
They have no name or slug, the clause entity mainly saves the relation between clause_body and document.

What is the idea behind that?

Regards,
Dennis

Lukas Kahwe Smith

unread,
Mar 15, 2010, 5:19:22 PM3/15/10
to dev-un-informedorg

That is indeed a problem. Today I tweaked the clause slug a bit, but its still not something people would memorize I fear.

$invoker = $event->getInvoker();
$clauseOrdering = $invoker->_get('Document')->_get('clause_ordering');

$slug = $invoker->_get('Document')->_get('code');
$slug.= ' '.$invoker->_get('clause_body_id');
$slug.= ' '.(str_word_count($clauseOrdering, 0, '023456789')+1);
$slug.= ' '.$invoker->_get('clause_number_information');
$slug.= ' '.$invoker->_get('clause_number_subparagraph');
$slug = Doctrine_Inflector::urlize($slug);
$invoker->_set('slug', $slug);

So basically the slug is the document code + the id of the clause_body + the position of the clause + additional clause number information + clause subparagraph. I guess the clause body id is the only piece of information that is totally meaningless to admins, but still its tricky.

What we might need is something a bit more fancy. As in you get auto complete just like with documents and the options you get presented is a list of the clauses with " the position of the clause + additional clause number information + clause subparagraph" but also linked so that people can open up the clause to see the details.

@Hannah: If this all sounds like gibberish I can try and explain it a bit simpler, but if you understand what we are talking about please give your input.

regards,
Lukas Kahwe Smith
sm...@pooteeweet.org

Lukas Kahwe Smith

unread,
Mar 15, 2010, 5:33:07 PM3/15/10
to Hannah Birkenkötter, Dennis Riedel, dev-un-informedorg

On 15.03.2010, at 22:24, Hannah Birkenkötter wrote:

> Hi,
>
> I was actually responding to Dennis' email right now, bc I thought I understood it - but then, I realized that in fact I didn't :) Are you talking about a name that you need for the clause (for the purpose of finding specific docs/clauses in the backend)? I guess this relates solely to the backend, not really to the front-end, or?
>
> So yes, an explanation in simpler terms would be much appreciated and I will definitely give my input once I understood the problem :)


This is a question for the admin tools. In a few places people will need to select a clause. For example when trying to do a follow up on a previous clause or when creating a relation from a document to a clause. Here we were planning to use livesearch. As in you start typing some piece of information about the clause and it automatically suggest you a list of possible matches, which you can then select.

For documents the most obvious choice here is the code with optionally maybe also supporting the name.
However for clauses there isnt really anything to use here besides the clause number+additional number info + subparagraph.

Lukas Kahwe Smith

unread,
Mar 15, 2010, 5:52:24 PM3/15/10
to Dennis Riedel, Hannah Birkenkötter, dev-un-informedorg

On 15.03.2010, at 22:34, Dennis Riedel wrote:

> Wow Lukas
>
> That sounds way more sophisticated than what I got out of the wiki :-) Especially as I refer myself to the backend. But as far as I understand your approach: you want to create a searchable string (a connection of information bits from document, clause, clause_body), to be able to search over it with a given search term, something alphanumeric the user has entered in the search box before? So we try to find something in it that matches the entered search term?

Well we could use the slug for that with a bit of tweaking, like moving the clause_body_id to the end ..
But like I said it would be nice to have some way to verify that the selected clause is actually the right one. So in the spirit of KISS (keeping it simple stupid) we could just use the slug for the autosuggest (we would have to apply the Doctrine_Inflector::urlize($slug) thing on the input string inside the action class before calling the autosuggest helper).

Then we could have a button next to the input form that when pressed takes the slug value and opens a new window with the clause.

Hannah Birkenkötter

unread,
Mar 15, 2010, 6:46:55 PM3/15/10
to Lukas Kahwe Smith, Dennis Riedel, dev-un-informedorg
Hi,

ok, I think now I get it. So just to fully understand this: the piece
of information to be inserted would be the code? Or the name? Or both?
(sorry for being so slow on this...)

If that's the question, then I guess the only way to find specific
clauses would be to go via the document, so essentially document code
+ clause number (because there may be multiple clauses with the same
clause number/subparagraph; however, the combination of doc code +
clause number is unique, except for very few exceptions). Do you mean
something like that by "additional clause number info", or what
exactly are you referring to there?

Again, sorry for being a bit slow :)

Best,

Hannah

Lukas Kahwe Smith

unread,
Mar 15, 2010, 6:50:14 PM3/15/10
to Hannah Birkenkötter, Dennis Riedel, dev-un-informedorg

On 15.03.2010, at 23:46, Hannah Birkenkötter wrote:

> ok, I think now I get it. So just to fully understand this: the piece of information to be inserted would be the code? Or the name? Or both? (sorry for being so slow on this...)

so you would enter the document code, the position and optionally the additional info and subparagraph

> If that's the question, then I guess the only way to find specific clauses would be to go via the document, so essentially document code + clause number (because there may be multiple clauses with the same clause number/subparagraph; however, the combination of doc code + clause number is unique, except for very few exceptions). Do you mean something like that by "additional clause number info", or what exactly are you referring to there?


exactly ..

@Dennis: going to bed soon .. but i guess for now we will just kick out the clause_body_id from the slug .. but i need to review once more why without the clause_body_id we could get duplicates. dont remember ..

Lukas Kahwe Smith

unread,
Mar 15, 2010, 6:56:58 PM3/15/10
to dev-un-in...@googlegroups.com, Hannah Birkenkötter, Dennis Riedel

On 15.03.2010, at 23:50, Lukas Kahwe Smith wrote:

> @Dennis: going to bed soon .. but i guess for now we will just kick out the clause_body_id from the slug .. but i need to review once more why without the clause_body_id we could get duplicates. dont remember ..


Actually its probably a bug in the computation of the position.


$slug.= ' '.(str_word_count($clauseOrdering, 0, '023456789')+1);

Which is weird because I make sure to update the document instance after every update:
$invoker->_get('Document')->refresh();

And the ordering the db is correct:
1,2,3,4,5

But in the DB it computes postion 1 for both clause 1 and 2 ..

http://code.google.com/p/uninformed/source/browse/trunk/lib/model/doctrine/Clause.class.php?spec=svn150&r=150

Lukas Kahwe Smith

unread,
Mar 22, 2010, 6:26:30 PM3/22/10
to dev-un-in...@googlegroups.com, Hannah Birkenkötter, Dennis Riedel

On 15.03.2010, at 23:56, Lukas Kahwe Smith wrote:

>
> On 15.03.2010, at 23:50, Lukas Kahwe Smith wrote:
>
>> @Dennis: going to bed soon .. but i guess for now we will just kick out the clause_body_id from the slug .. but i need to review once more why without the clause_body_id we could get duplicates. dont remember ..
>
>
> Actually its probably a bug in the computation of the position.
> $slug.= ' '.(str_word_count($clauseOrdering, 0, '023456789')+1);

and the bug of course was in the code above .. was missing a "1" in the list of numbers :)
fixed in svn .. clause_body_id is also out .. so we can provide nice human readable links for clauses consisting of the associated document code and all the clause number information.

Reply all
Reply to author
Forward
0 new messages